简体   繁体   中英

WP7-Skydrive API Download Any file and Save Isolated Storage

I'm trying to download file on skydrive, but it isn't working.

            LiveConnectClient client = new LiveConnectClient(session);
        client.DownloadCompleted += new EventHandler<LiveDownloadCompletedEventArgs>(DownloadCompleted);
        client.DownloadAsync(fileid);
        //-----------------------------------------------------------------
        void DownloadCompleted(object sender, LiveOperationCompletedEventArgs e)
        {
            StreamReader reader = new StreamReader(e.Result);
            string text = reader.ReadToEnd();
            IsolatedStorageFile Isofiles = IsolatedStorageFile.GetUserStoreForApplication();
            using (var isoFileStream = new IsolatedStorageFileStream("Testfile", FileMode.OpenOrCreate, Isofiles))
            {
                using (var isoFileWriter = new StreamWriter(isoFileStream))
                {
                    isoFileWriter.Write(text);
                }
            }
        }

What am I doing wrong?

Your only getting the metadata with this line

client.DownloadAsync(fileid);

Add /content to the fileid like this to get the actual filecontent.

client.DownloadAsync(fileid + "/content");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM