Answered by:
Download and open a text file from skydrive

Question
-
Hi
Is it possible to upload a notepad file to skydrive and then write a program that downloads it to a local directory and opens (File.ReadContents) it in a textWindow so you can read the contents?
Below is what I've tried and all it returns is a page of html code.
ElseIf Controls.LastClickedButton = button[3] Then 'show code downloadCode = Network.DownloadFile("http://sdrv.ms/Z64b00") TextWindow.WriteLine(downloadCode) TextWindow.WriteLine(File.CopyFile(downloadCode, "c:\temp\codeFile.txt")) TextWindow.WriteLine(File.ReadContents("c:\temp\codeFile.txt")) TextWindow.Pause() TextWindow.Hide()
Wednesday, April 3, 2013 3:39 AM
Answers
-
Remember the link I've mentioned above was extract from RPC846-4. I've just glued them together from the arrays and variables!
That is, I've reverted the process I made for the animation sample! ^_^
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
- Edited by GoToLoopEditor Saturday, April 6, 2013 1:47 AM
- Marked as answer by Jibba j Monday, April 8, 2013 10:14 AM
Saturday, April 6, 2013 1:47 AMAnswerer
All replies
-
You need to have the full txt path of the upload, not the upload page, i'm sure you can find that by right-clicking the "Download" button, and clicking copy URL link or something like that.Wednesday, April 3, 2013 9:57 AM
-
Thanks Ashkore
I've tried the full URL path and it returns HTML code.
When I download using SB code, i.e.
TextWindow.WriteLine(Network.DownloadFile("https://skydrive.live.com/red..........")
it downloads a temp file.tmp
When I open this file in textWindow it returns HTML Code.
Would appreciate a specific code sample to do this or an explanation why it can't be done.
I think the problem is that downloading the file within SB can only return HTML code, whereas d/loading using Outlook and IE will d/load it as a .txt file. Not sure, because SB can d/load pics of the web.....??
Wednesday, April 3, 2013 11:23 AM -
A post from October last year, I had tweaked a Sonic animation example to directly download from SkyDrive!
That is, the logic behind on the real download full path!
Dunno whether it still works though. Take a look at this huge post below and search for my example there:
Here's its import code too -> RPC846-4
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
- Edited by GoToLoopEditor Wednesday, April 3, 2013 12:23 PM
- Proposed as answer by Nonki Takahashi Thursday, April 4, 2013 1:10 AM
- Marked as answer by Jibba j Thursday, April 4, 2013 2:58 AM
- Unmarked as answer by Jibba j Friday, April 5, 2013 10:41 PM
Wednesday, April 3, 2013 12:12 PMAnswerer -
GoTo thanks, I'll check it out.Wednesday, April 3, 2013 1:06 PM
-
Hi goto
reading your code:
- is the shortcut that skydrive gives for the longer path "the logic behind on the real download full path!"??
- is the the longer path "the logic behind on the real download full path!"??
from your code:
- code = "1=msglqg
- hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/"
I thought I tried this before, i'll go back and check. I just hope that it applies for .txt(.tmp) as well as .png
I'll leave this question unanswered for a bit longer to see if anyone else has a comment.
Friday, April 5, 2013 10:57 PM -
As you had noticed, the "secret" isn't something straight to the point!
Each SkyDrive file has 2 hashes -> 1 short and the other big. And between them, a domain name.
What I did was organize them into arrays. This organization is what I called "logic" behind a file real full path! @_@
To get a file full path, I remember I had to choose to visualize each picture, and got its path from browser's address box.
Here's an example:
Of course, you can simply use 1 array only to store a full path. I just separated them to be able to also load locally w/o much further modifications!
Hope you can figure it out! *_*
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
- Edited by GoToLoopEditor Saturday, April 6, 2013 12:17 AM
Saturday, April 6, 2013 12:09 AMAnswerer -
Thanks goto, checked your link, has the file sonic.png in the browser path.
It's not looking so straight forward for outlook. Outlook doesn't support opening .txt in browser. To open other files it does so through webApps. As for pics you can view in browser but not open.
https://skydrive.live.com/?cid=35f77cb29bbb6f08#cid=35F77CB29BBB6F08&id=35F77CB29BBB6F08%21499 path to .txt
https://skydrive.live.com/?cid=35f77cb29bbb6f08#cid=35F77CB29BBB6F08&id=35F77CB29BBB6F08%21503 path to .jpg
Oh well...
Solution might be a different server for this task.
Thanks, your path to .png seems to have resolved this for me.
Saturday, April 6, 2013 1:01 AM -
Remember the link I've mentioned above was extract from RPC846-4. I've just glued them together from the arrays and variables!
That is, I've reverted the process I made for the animation sample! ^_^
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
- Edited by GoToLoopEditor Saturday, April 6, 2013 1:47 AM
- Marked as answer by Jibba j Monday, April 8, 2013 10:14 AM
Saturday, April 6, 2013 1:47 AMAnswerer -