2012-07-30 85 views
0

我試圖在skydrive上下載文件,但它不工作。WP7-Skydrive API下載任何文件並保存隔離存儲

  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); 
       } 
      } 
     } 

我在做什麼錯?

+0

這是什麼意思「它不工作」?請在您的問題中添加更多有關哪些功能無法正常工作的信息,以便我們可以幫助您 – 2012-07-30 20:07:06

+0

你試過調試嗎?是提出的DownloadCompleted?是從流讀取器創建的文本字符串? – 2012-07-30 20:20:24

+0

是的,我已經嘗試過從流讀取器創建的調試和文本字符串 – Oguzhan 2012-07-30 20:29:22

回答

0

你只得到了元數據與該行

client.DownloadAsync(fileid); 

添加/內容,像這樣的fileid獲取實際filecontent。

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