This documentation is archived and is not being maintained.

WL.createBackgroundDownload

Last modified: March 13, 2015

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

This is an async method that returns a Promise object, which allows you to attach events to receive download operations, or handle errors.

Note Note

WL.createBackgroundUpload is supported only for use with Windows Runtime apps using JavaScript. If you are writing a web app, use WL.upload instead.

Parameters

  • properties

    Required. A JSON object that contains the following properties, which are necessary to make the REST API call:

    Name

    Type

    Description

    Default Value

    path

    string

    Required. The path to the file to download. For information on specifying paths for REST objects, see REST reference.

    None

    file_output

    Windows.Storage.StorageFile

    Optional. The file output object to which the downloaded file data is written.

    None

  • callback

    Optional. A callback function that is invoked when the download call is complete.

    Note Note

    Although the callback parameter is still supported, we recommend that you use the Promise object instead, which is described later in this topic.

Return value

Returns a Promise object. This object allows you to attach events to handle success, errors, and progressed situations.

Remarks

A download operation consists of:

  • A Guid property that allows you to track the download operation.

  • A start() method to start the operation.

If the call is successful, you will receive a download operation in the onSuccess event.

Note Note

Before calling the WL.createBackgroundDownload function, your code must call either the WL.init or WL.login function with, at minimum, the required scopes for downloading the corresponding files. If you don't do this, the download operation created from the WL.createBackgroundDownload function may fail. Also, this requirement applies to each webpage's current session. Therefore, if your app contains multiple webpages, each webpage must follow this requirement.

Requirements

Minimum supported client

Windows8.1 [Windows Store apps only]

Minimum supported server

None supported [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

Library

Wl.js

DLL

N/A

Show: