BackgroundTransferRequest Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Represents a background file transfer request.

Inheritance Hierarchy

System..::.Object
  Microsoft.Phone.BackgroundTransfer..::.BackgroundTransferRequest

Namespace:  Microsoft.Phone.BackgroundTransfer
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public NotInheritable Class BackgroundTransferRequest _
    Implements IDisposable
public sealed class BackgroundTransferRequest : IDisposable

The BackgroundTransferRequest type exposes the following members.

Constructors

  Name Description
BackgroundTransferRequest(Uri) Initializes a new instance of the BackgroundTransferRequest class with the specified request URI.
BackgroundTransferRequest(Uri, Uri) Initializes a new instance of the BackgroundTransferRequest class with the specified request URI and download file location.

Top

Properties

  Name Description
BytesReceived Gets the number of bytes that have been downloaded for the request.
BytesSent Gets the number of bytes that have been uploaded for the request.
DownloadLocation Gets or sets the location to which the requested file will be downloaded.
Headers Gets the dictionary of HTTP headers for the request.
Method Gets or sets the HTTP method for the request.
RequestId Gets the unique identifier associated with the request.
RequestUri Gets the target URI associated with the request.
StatusCode The HTTP status code of the request
Tag Gets or sets additional data associated with the request.
TotalBytesToReceive Gets the total number of bytes that will be downloaded for the request.
TotalBytesToSend Gets the total number of bytes that will be uploaded for the request.
TransferError Gets the exception associated with a failed background transfer request. A transfer request can have a TransferStatus of Completed whether or not the transfer was completed successfully. If a completed transfer was successful, TransferError will be null.
TransferPreferences Gets or sets the preferred conditions under which transfers are enabled.
TransferStatus Gets the status of the request.
UploadLocation Gets or sets the location from which the requested file will be uploaded.

Top

Methods

  Name Description
Dispose Releases all resources used by the current instance of the BackgroundTransferRequest class.
Equals(BackgroundTransferRequest) Determines whether this BackgroundTransferRequest is equal to the specified object.
Equals(Object) Determines whether this BackgroundTransferRequest is equal to the specified object. (Overrides Object..::.Equals(Object).)
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetHashCode Returns the hash code for this instance. (Overrides Object..::.GetHashCode()()().)
GetType Gets the Type of the current instance. (Inherited from Object.)
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
ToString Returns a string representation of the BackgroundTransferRequest object. (Overrides Object..::.ToString()()().)

Top

Events

  Name Description
TransferProgressChanged Occurs when the progress of the transfer changes.
TransferStatusChanged Occurs when the TransferStatus property of a request changes.

Top

Remarks

Create a BackgroundTransferRequest object representing a file transfer request and then use the Add method of the BackgroundTransferService class to register the request with the system. Use the Find method to get a BackgroundTransferRequest object representing a transfer request that has already been submitted to obtain status information about the transfer.

For more information on background file transfers, see Background file transfers for Windows Phone 8.

Capabilities

If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.

ID_CAP_NETWORKING

Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Platforms

Windows Phone

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Phone.BackgroundTransfer Namespace