0

I have an app that I want to download & upload a simple .txt file with a URL inside. I have downloaded Live Connect SDK V5.4, referenced the documentation, but it appears that the documentation is incorrect. The sample code uses event handlers for when a download/upload is complete, but that no longer can be used in V5.4.

I have two methods, downURL & upURL. I have started working on downURL:

    private async void downURL()
    {
        try
        {
            LiveDownloadOperationResult download = await client.DownloadAsync("URL.txt");
        }
        catch { }
    }

I am not sure what I am suppose to use for the path, I put "URL.txt" for now, I've seen some examples with "/me/". Do I need this? The file does not need to be visible to the user, as the user can't really do anything with it, but it is vital for the app to work.

My question is how do I use the LiveDownloadOperationResult download to save the file to Isolated Storage Settings, get the text contents, and put that in a string? Also, if you know how to upload the file back up, the upload event handler looks the same (but without the Result variable).

Bailey Stein
  • 331
  • 2
  • 12

1 Answers1

1

This code help you download content a file which you want. It get content have format OpenXML Here, "item.id" is Id of "URL.txt".

private async void downURL()
{
    try
    {                   
                        LiveDownloadOperationResult operationResult = await client.DownloadAsync(item.id + "/Content?type=notebook");

                        StreamReader reader = new StreamReader(operationResult.Stream);

                        string Content = await reader.ReadToEndAsync(); 
    }
    catch { }
}
  • Thank you for the help, but I figured it out and posted how to do it here: http://www.baileystein.com/2013/10/20/skydrive-how-to-upload-and-download-a-text-file-on-wp8/ – Bailey Stein Dec 08 '13 at 00:38
  • Ok. Do you know how to load a word file from skydrive and read it? I have do it but not working... – Mquy Nguyen Dec 10 '13 at 07:25
  • You would need something like this: http://www.c-sharpcorner.com/UploadFile/mgold/WordFromDotNet11082005235506PM/WordFromDotNet.aspx – Bailey Stein Dec 10 '13 at 11:40
  • Thank you! But i mean is download a doc file from Sydrive and display it on the Windows Phone 8 device. – Mquy Nguyen Dec 13 '13 at 09:50
  • You're going to need to do some research. I would suggest taking a look at this: http://sourceforge.net/projects/word-reader/ – Bailey Stein Dec 13 '13 at 14:34