Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LiveConnectClient.BackgroundUploadAsync(String, String, IStorageFile, OverwriteOption, CancellationToken, IProgress<LiveOperationProgress>) method

Uploads a resource with a given path, file name, file contents, cancellation token, LiveOperationProgress, and the option to overwrite an existing file. [Windows Store apps only]

Note  Windows Phone doesn't support this method.

Syntax


public Task<LiveOperationResult> BackgroundUploadAsync(
  string path, 
  string fileName, 
  IStorageFile inputFile, 
  OverwriteOption option, 
  CancellationToken ct, 
  IProgress<LiveOperationProgress>  progress
)

Parameters

path

Type: System.String

The destination path for the upload.

fileName

Type: System.String

The name of the file to upload.

inputFile

Type: IStorageFile

The file to add to the body of the API call.

option

Type: OverwriteOption

Specifies whether the file that's being uploaded to OneDrive should overwrite an existing file with the same file name in that location.

ct

Type: CancellationToken

The cancellation token that is used to provide notification that operations should be cancelled.

progress

Type: IProgress<LiveOperationProgress>

The progress handler that the calling app uses to receive progress updates.

Return value

Type: Task<LiveOperationResult>

The LiveOperationResult object with the populated session and result.

Error codes

NameMeaning
ArgumentNullException

A parameter that was passed in is null.

Remarks

This method uses an HTTP PUT call to the Live SDK REST reference and returns the response as an IStorageFile.

BackgroundUploadAsync automatically uses the access token returned from user sign-in by the constructor, making it possible for a site to omit working directly with access tokens. If the access token cookie is set, BackgroundUploadAsync uses that as well.

Important  Before calling this method, your code must call either the LiveAuthClient.InitializeAsync or LiveAuthClient.LoginAsync method with, at minimum, the corresponding necessary scopes for [downloading | uploading | copying | deleting | reading | moving | creating | updating] the corresponding [data | files | file]. If you don’t, the call to this method may fail.

Requirements

Minimum supported client

Windows 8

Minimum supported server

None supported

Namespace

Microsoft.Live

Assembly

Microsoft.Live.dll

See also

LiveConnectClient

 

 

Show:
© 2014 Microsoft