0
 async  private void uploadtosky_Click(object sender, RoutedEventArgs e)
{
    try
    {
       LiveAuthClient auth = new LiveAuthClient();

       LiveLoginResult log = await auth.LoginAsync(new List<string> { "wl-basic", "wl.skydrive", "wl.signin" });

       if (log.Status == LiveConnectSessionStatus.Connected)
       {
           LiveConnectClient uploadcl = new LiveConnectClient(auth.Session);
           LiveOperationResult up = await uploadcl.BackgroundUploadAsync("me/skydrive", heading.Text, samplefile, OverwriteOption.Overwrite);

       }                
    }
    catch
    {
        MessageDialog msg = new MessageDialog("Oops ! something went wrong while trying to connect");
        msg.ShowAsync();
    }



}

当我执行代码片段时,messagebox显示Oops ! something went wrong while trying to connect. 我的计算机已连接到 Internet,单击上传按钮后,我会在 Windows 8 应用程序中获得一个真实帐户的登录页面。但是我猜它无法登录该帐户,因此会发生异常。有什么想法可以克服这个问题吗?

4

2 回答 2

0

你的文件有多大?是否大于 300MB?我记得大文件在上传时有一些问题。

于 2012-12-23T16:20:29.983 回答
0

终于找到了答案。实际上需要将 auth.Session 替换为 log.Session (在该行中LiveConnectClient uploadcl = new LiveConnectClient(auth.Session);)并添加一个名为 wl.skydrive_update 的范围LiveLoginResult log = await auth.LoginAsync(new List<string> { "wl-basic", "wl.skydrive", "wl.signin" });

就是这样 !

于 2012-12-28T18:10:25.717 回答