![](/img/trans.png)
[英]how to access skydrive other users shared folders and files using C# WP7
[英]WP7 - How to download and save files from skydrive
我必须将文件从skdrive上的文件夹保存到我的隔离存储中(如果隔离存储中的文件存在,请覆盖它们)。
这是我的代码:
private void RestoreData(LiveConnectClient liveClient, string storedFolderId)
{
liveClient.DownloadCompleted += liveClient_DownloadCompleted;
liveClient.DownloadAsync(storedFolderId + "/content");
}
private void liveClient_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e)
{
Stream stream = e.Result;
// HOW TO SAVE FILES ON IN THIS METHOD?
}
如何在liveClient_DownloadCompleted方法中保存文件?
我找到解决方案:
private void liveClient_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e)
{
Stream stream = e.Result;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileToSave = storage.OpenFile("tasks.xml", FileMode.Create, FileAccess.ReadWrite))
{
stream.CopyTo(fileToSave);
stream.Flush();
stream.Close();
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.