Windows Store apps

501 out of 618 rated this helpful - Rate this topic

Windows Store apps can use the Live SDK to enable single sign-on with Microsoft accounts and to work with info in Microsoft OneDrive, and Outlook.com. The Live SDK is available for Windows Store apps using JavaScript and managed programming languages like C# and Microsoft Visual Basic. Apps that use other programming languages can use other Live Connect APIs that are available for their app types, or they can use the Live Connect Representational State Transfer (REST) APIs and OAuth 2.0 endpoints directly.

Note   This topic applies to you only if you want to add Live Connect services to a Windows Store app. If you want to add Live Connect services to another type of app, go to Mobile and Windows desktop apps or find your type of app in the menu on the right.

Register your Windows Store app

Before your Windows Store app can use the Live Connect APIs, you need to register it with the Windows Store as described in Configuring your app.

Referencing the Live Connect APIs from your Windows Store app using JavaScript

To reference the Live Connect APIs from a Windows Store app using JavaScript project in Microsoft Visual Studio Express 2012 for Windows 8, do this:

  1. Install the Live SDK, if you haven't already done so.
  2. In your project, in Solution Explorer, right-click References > Add Reference.
  3. Click Windows > Extension SDKs > Live SDK.
  4. Click Add, and then click Close.
  5. To enable Microsoft IntelliSense in default.html, add this <script> element in the <head> element.
    
    
    <script src="///LiveSDKHTML/js/wl.js"></script>
    
    
  6. To enable IntelliSense in any other JavaScript (.js) file in your project, add this comment to the top of that .js file.
    
    
    /// <reference path="///LiveSDKHTML/js/wl.js" />
    
    

Top

Referencing the Live Connect APIs from your Windows Store app using XAML and C#

To reference the Live Connect APIs from a Windows Store app project using C# in Visual Studio Express 2012 for Windows 8, do this:

  1. Install the Live SDK, if you haven't already done so.
  2. In your project, in Solution Explorer, right-click References > Add Reference.
  3. Click Windows > Extensions > Live SDK > OK.
  4. Add the corresponding using statements to your code, like this.
    
    
    using Microsoft.Live;
    
    

Top

Code samples

Here are some code samples that show how to:

  • Invite a user to sign in.
  • Get permission from the signed-in users to access their basic profile info.
  • Greet signed-in users with their first and last names.

Signing users in from Windows Store apps using JavaScript

default.html

This code example displays the Windows 8 sign-in prompt when the app starts and requests access to the user's OneDrive.


WL.Event.subscribe("auth.login", onLoginComplete);
WL.init();
WL.login({
    scope: ["wl.signin", "wl.skydrive"]
});

Note   For more info about signing users in from Windows Store apps using JavaScript, see Guidelines for the Microsoft account sign-in experience.

Signing users in from Windows Store apps using XAML and C#

The sign-in coding patterns that are appropriate for Windows Store apps using C# are described in the Guidelines for the Microsoft account sign-in experience.

Top

Next steps

You can learn more about using the Live Connect APIs from these topics:

Top

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.