2012-12-18 53 views
1

我正在使用SkyDrive創建一個WP7應用程序訪問它。我正在使用SkyDrive API。當我嘗試登錄時,它顯示'Inalid Request'錯誤。任何人都可以告訴我我的代碼有什麼問題嗎?登錄SkyDrive API for Windows Phone應用程序的問題

private void login_Click() 
    { 
     LiveAuthClient auth = new LiveAuthClient("signInButton1.ClientId"); 
     auth.LoginCompleted += 
     new EventHandler<LoginCompletedEventArgs>(MoreScopes_LoginCompleted); 
     auth.LoginAsync(new string[] { "wl.signin", "wl.basic", "wl.skydrive", "wl.skydrive_update " }); 
    } 

    void MoreScopes_LoginCompleted(object sender, LoginCompletedEventArgs e) 
    { 

     if (e.Status == LiveConnectSessionStatus.Connected) 
     { 
      LiveConnectSession session = e.Session; 
      LiveConnectClient client = new LiveConnectClient(session); 
      infoTextBlock.Text = "Signed in."; 
     } 
     else if (e.Error != null) 
     { 
      infoTextBlock.Text = "Error signing in: " + e.Error.ToString(); 
     } 
    } 

    private void signInButton1_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e) 
    { 
     login_Click(); 

    } 

回答

0
 
Check this: 

    LiveAuthClient auth = new LiveAuthClient("signInButton1.ClientId"); 

it should be: 

    LiveAuthClient auth = new LiveAuthClient(signInButton1.ClientId); 

相關問題