简体   繁体   English

WP7-Skydrive API下载任何文件并保存隔离存储

[英]WP7-Skydrive API Download Any file and Save Isolated Storage

I'm trying to download file on skydrive, but it isn't working. 我正在尝试在skydrive上下载文件,但无法正常工作。

            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. 像这样在文件ID中添加/ content以获得实际的文件内容。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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