locked
[UWP][C#] Access Outlook.com calendar in Win 10 RRS feed

  • Question

  • I'm trying to write a UWP app that will get some information from the user's Outlook.com calendar in Win 10.  I've tried using the Live SDK 5.6.2 using the code below, but I get a NullReferenceException calling InitializeAsync, or LoginAsync.

    try { // Initialize access to the Live Connect SDK. LiveAuthClient LCAuth = new LiveAuthClient(); LiveLoginResult LCLoginResult = await LCAuth.InitializeAsync(); try { // Sign in to the user's Microsoft account with the required scope. // // This call will display the Microsoft account sign-in screen if the user // is not already signed in to their Microsoft account through Windows 8. // // This call will also display the consent dialog, if the user has // has not already given consent to this app to access the data described // by the scope. // LiveLoginResult loginResult = await LCAuth.LoginAsync(new string[] { "wl.basic", "wl.calendars" }); if (loginResult.Status == LiveConnectSessionStatus.Connected) { // Create a client session to get the profile data. LiveConnectClient connect = new LiveConnectClient(LCAuth.Session); // Get the profile info of the user. LiveOperationResult operationResult = await connect.GetAsync("me"); // Format the text to display and update the element in the layout. dynamic result = operationResult.Result; if (result != null) { this.userName.Text = string.Join(" ", "Hello", result.name, "!"); } else { this.userName.Text = "Unable to get your name."; } } } catch (LiveAuthException e) { // handle the login, scope, or request exception } } catch (LiveAuthException e) { // handle the initialization exception } catch (LiveConnectException e) { // handle the Live Connect API exception }

    Exception
       at Microsoft.Live.ResourceHelper.GetString(String name)
       at Microsoft.Live.TailoredAuthClient.<AuthenticateAsync>d__0.MoveNext()

    From reading online I've seen several suggestions as to what this problem is but none of the solutions seem to work:

    Solution 1) You need to register your app in the Windows Store Dashboard to access the Outlook services.

    I've tried this, and updated the Identity in the package.appxmanifest to match, but it doesn't make a difference.

    Solution 2) You need to associate the project with the store via Visual Studio right clicking on the project->Store->Associate App with the Store

    The option is disabled in my project.  I'm assuming because I created it as a UWP app and it is already associated with the store?

    Any other ideas on what could be wrong?  Am I just approaching this incorrectly and should be using some other method than Live SDK?

    I have a Win 8.1 Universal App sample that accesses OneDrive using the same code and it works properly.




    Monday, June 1, 2015 9:31 PM

All replies

  • I've tried switching back to Live SDK 5.6.0 and now I get this exception, so it seems possibly related to the inability to associate the app with the store.  Any ideas for that?

    The application requesting authentication tokens is either disabled or incorrectly configured. (Exception from HRESULT: 0x80860003)
    Monday, June 1, 2015 11:12 PM