JavaScript reference (Windows Store app and web)

The Live SDK JavaScript API (Windows Universal app and web) and the REST API, enables apps to read, update, and share user data by using JavaScript. It provides methods for signing users in and out, getting user status, subscribing to events, creating UI controls, and calling the Representational State Transfer (REST) API.

The WL object is a global object that encapsulates all functions of the Live SDK JavaScript API (Windows Store app and web). Your app uses the WL object to call all of the Live SDK JavaScript API functions.

Note

All of the following functions apply to both Windows Universal apps and web apps unless otherwise noted.

This section contains the following topics.

Topic

Description

Using the JavaScript Library

Shows how to include the Live SDK JavaScript API in your app.

WL.api

Enables you to make calls to the Live SDK REST API.

WL.backgroundDownload (Windows Runtime app)

Makes a call to download a file from Microsoft OneDrive.

WL.backgroundUpload (Windows Runtime app)

Makes a call to upload a file to OneDrive.

WL.canLogout

Specifies whether the current user can be signed out of his or her Microsoft account.

WL.createBackgroundDownload

Creates a background transfer operation to download a file from OneDrive.

WL.createBackgroundUpload

Creates a background transfer operation to upload a file to OneDrive.

WL.download (web)

Makes a call to download a file from OneDrive.

WL.Event.subscribe

Subscribes to an event.

WL.Event.unsubscribe

Unsubscribes from an event.

WL.fileDialog (web)

Displays the OneDrive file picker, which enables JavaScript-based web apps to display a pre-built, consistent user interface that enables a user to select files to upload and download to and from his or her OneDrive storage location.

WL.getCurrentBackgroundDownloads

Gets current pending background download operations.

WL.getCurrentBackgroundUploads

Gets current pending background upload operations.

WL.getLoginStatus

Gets the user's status as he or she is signing in.

WL.getSession

Gets the session object for the user.

WL.init

Initializes the Live SDK JavaScript API.

WL.login

Signs a user in or requests additional permissions.

WL.logout

Signs a user out.

WL.ui

Enables you to display UI elements, such as the Microsoft account sign-in button and the OneDrivefile picker, in your app.

WL.upload (web)

Makes a call to upload a file to OneDrive.

JSONP Scenarios

Shows how to use JavaScript Objection Notation with padding (JSONP) in client-side JavaScript web page code to interact directly with the Live SDK REST API.