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.

UploadOperation class

Applies to Windows and Windows Phone

Performs an asynchronous upload operation. For an overview of Background Transfer capabilities, see Transferring data in the background. Download the Background Transfer sample for examples in JavaScript, C#, and C++.

Syntax


public ref class UploadOperation sealed : IBackgroundTransferOperation,
    IBackgroundTransferOperationPriority

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The UploadOperation class has these types of members:

Methods

The UploadOperation class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
AttachAsync Returns an asynchronous operation that can be used to monitor progress and completion of the attached upload. Calling this method allows an app to attach upload operations that were started in a previous app instance.
GetResponseInformation Gets the response information.
GetResultStreamAt Gets the partially uploaded response at the specified location.
StartAsync Starts an asynchronous upload operation.

 

Properties

The UploadOperation class has these properties.

PropertyAccess typeDescription

CostPolicy

Read/writeGets and sets the cost policy for the upload.

Group

Read-onlyGets a string value indicating the group the upload belongs to.

Guid

Read-onlyThis is a unique identifier for a specific upload operation. A GUID associated to a upload operation will not change for the duration of the upload.

Method

Read-onlyGets the method to use for the upload.

Priority

Read/writeGets or sets the transfer priority of this upload operation when within a BackgroundTransferGroup. Possible values are defined by BackgroundTransferPriority.

Progress

Read-onlyGets the current progress of the upload operation.

RequestedUri

Read-onlyGets the URI to upload from.

SourceFile

Read-onlySpecifies the IStorageFile to upload.

TransferGroup

Read-onlyGets the group that this upload operation belongs to.

 

Remarks

After app termination, an app should enumerate all existing UploadOperation instances at next start-up using GetCurrentUploadsAsync. When a Windows Store app using Background Transfer is terminated, incomplete uploads will persist in the background. If the app is restarted after termination and these incomplete operations are not enumerated and re-introduced to the current session, they will go stale and continue to occupy device resources.

Timeout considerations

1.) When establishing a new connection for an upload over TCP/SSL, the connection attempt is aborted if not established within five minutes.

2.) After the connection has been established, an HTTP request message that has not received a response within two minutes is aborted.

Assuming there is Internet connectivity, Background Transfer will retry an upload up to three times. In the event Internet connectivity is not detected, additional attempts will not be made until it is.

Debugging Guidance

Stopping a debugging session in Microsoft Visual Studio is comparable to closing your app; PUT uploads are paused and POST uploads are aborted. Even while debugging, your app should enumerate and then pause, restart, or cancel any persisted uploads.

However, if Visual Studio project updates, like changes to the app manifest, require that the app is uninstalled and re-deployed for debugging, GetCurrentUploadsAsync cannot enumerate persisted operations created using the previous app deployment.

Examples

The following example demonstrates how to configure and begin a basic upload operation, and is based on the Background Transfer sample offered in the Windows Sample Gallery.

No code example is currently available or this language may not be supported.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Networking.BackgroundTransfer
Windows::Networking::BackgroundTransfer [C++]

Metadata

Windows.winmd

Capabilities

internetClient
internetClientServer
privateNetworkClientServer

See also

Quickstart: Upload a file
Background Transfer sample

 

 

Show:
© 2014 Microsoft