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.
Required. A JSON object that contains the following properties, which are necessary to make the REST API call:
Name Type Description Default Value
Required. The path to the file to download. For information on specifying paths for REST objects, see REST reference.
Optional. The file output object to which the downloaded file data is written.
Optional. A callback function that is invoked when the download call is complete.
Note Although the callback parameter is still supported, we recommend that you use the Promise object instead, which is described later in this topic.
Returns a Promise object. This object allows you to attach events to handle success, errors, and progressed situations.
A download operation consists of:
- A Guid property that allows you to track the download operation.
start()method to start the operation.
If the call is successful, you will receive a download operation in the onSuccess event.
Important 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.
Minimum supported client
|Windows 8.1 [Windows Store apps only]|
Minimum supported server
|None supported [Windows Store apps only]|
Minimum supported phone
|Windows Phone 8.1|