UploadOperation.StartAsync UploadOperation.StartAsync UploadOperation.StartAsync UploadOperation.StartAsync UploadOperation.StartAsync Method

Definition

Starts an asynchronous upload operation.

public : IAsyncOperationWithProgress<UploadOperation, UploadOperation> StartAsync()
IAsyncOperationWithProgress<UploadOperation, UploadOperation> StartAsync() const;
public IAsyncOperationWithProgress<UploadOperation, UploadOperation> StartAsync()
Public Function StartAsync() As IAsyncOperationWithProgress(Of UploadOperationUploadOperation)
Windows.Networking.BackgroundTransfer.UploadOperation.startAsync().done( /* Your success and error handlers */ );

Returns

Remarks

Exceptions

COMException

Thrown when a feature-specific HRESULT is returned from a method call.

This is the most common exception that is thrown by networking methods. An app should use the HRESULT from the exception to determine the cause of the error. For more information on specific errors, see the Error Codes section below.

AccessDeniedException

Thrown when access is denied to a resource or feature. This exception occurs when an app doesn't have the required network capabilities set in the app manifest for the network operation requested.

InvalidArgumentException

Thrown when one of the arguments that are provided to a method is not valid.

If user-supplied input caused this exception, an app could inform the user and request new input.

ObjectDisposedException

Thrown when an operation is performed on a disposed object.

OutOfMemoryException

Thrown when insufficient memory is available to complete the operation.

An upload operation must be scheduled using one of the BackgroundUploader.CreateUpload, BackgroundUploader.CreateUploadAsync , or BackgroundUploader.CreateUploadFromStreamAsync methods before the StartAsync method is called.

Important

Queuing up a large number of transfers on the main UI thread can result in degraded performance of your app's UI, even though the call is awaitable. If you are queuing up a large number of transfers, it is recommended that you call StartAsync on a background worker thread as in the following example.

operation = await Task.Run(() => { return myUploadOperation.StartAsync(); });

See also