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.

BackgroundTransferContentPart class

Applies to Windows and Windows Phone

Represents a content part of a multi-part transfer request. Each BackgroundTransferContentPart object can represent either a single string of text content or a single file payload, but not both.

Syntax


public ref class BackgroundTransferContentPart sealed 

Attributes

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

Members

The BackgroundTransferContentPart class has these types of members:

Constructors

The BackgroundTransferContentPart class has these constructors.

ConstructorDescription
BackgroundTransferContentPart() Creates a BackgroundTransferContentPart object.
BackgroundTransferContentPart(String) Creates a BackgroundTransferContentPart object that identifies the content it represents.
BackgroundTransferContentPart(String, String) Creates a BackgroundTransferContentPart object that identifies the file content and the name of the file that it represents.

 

Methods

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

MethodDescription
SetFile Sets the source file for a BackgroundTransferContentPart containing the file for upload.
SetHeader Sets content disposition header values that indicate the nature of the information that this BackgroundTransferContentPart represents.
SetText Use this method to set text information that the BackgroundTransferContentPart represents.

 

Examples

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


        
        var upload = null;
        var promise = null;

        function MultipartUpload (uriString, files) {
            try {

                var uri = Windows.Foundation.Uri(uriString);
                var uploader = new Windows.Networking.BackgroundTransfer.BackgroundUploader();
                var contentParts = [];
                files.forEach(function (file, index) {
                    var part = new Windows.Networking.BackgroundTransfer.BackgroundTransferContentPart("File" + index, file.name);
                    part.setFile(file);
                    contentParts.push(part);
                });

                // Create a new upload operation.
                uploader.createUploadAsync(uri, contentParts).then(function (uploadOperation) {
                    // Start the upload and persist the promise to be able to cancel the upload.
                    upload = uploadOperation;
                    promise = uploadOperation.startAsync().then(complete, error, progress);
                });
            } catch (err) {
                displayError(err);
            }
        };

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

CreateDownload(Uri, IStorageFile, IStorageFile)
CreateUploadAsync
Object

 

 

Show:
© 2014 Microsoft