Windows Dev Center

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.

StandardDataFormats.StorageItems | storageItems property

A read-only property that returns the format ID string value corresponding to the StorageItem format.

Syntax


var storageItems = Windows.ApplicationModel.DataTransfer.StandardDataFormats.storageItems;

Property value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The format ID string value corresponding to the StorageItem format.

Examples

This example demonstrates the use of the StorageItems property. To use the code in this example, add an event listener to your app to handle the activated event. Then put this code in the function that this event listener calls.


var imageFile;
var picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.fileTypeFilter.replaceAll([".jpg", ".bmp", ".gif", ".png", ".wmv"]);
picker.pickSingleFileAsync().then(function (file) {
    logText("PickImage: Picker returned a file");
    imageFile = file;
});

function onDeferredImageRequested(request) {
    try {
        if (imageFile) {
            // This is to make sure deferral works even in synchronous case
            var deferral = request.getDeferral();
            var imageStreamRef = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile);
            request.setData(imageStreamRef);
            deferral.complete();
        }
    } catch (exc) {
        // Error handling goes here.
    }
}


function shareFiles() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", function (e) {
        var request = e.request;
        request.data.properties.title = "Share Files Example";
        request.data.properties.description = "A demonstration that shows how to share files.";
        request.data.properties.fileTypes.replaceAll([".jpg", ".bmp", ".gif", ".png", ".wmv"]);
        request.data.setDataProvider(Windows.ApplicationModel.DataTransfer.StandardDataFormats.bitmap, onDeferredImageRequested);
    });
}



Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.DataTransfer
Windows::ApplicationModel::DataTransfer [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

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

Namespace

Windows.ApplicationModel.DataTransfer
Windows::ApplicationModel::DataTransfer [C++]

Metadata

Windows.winmd

See also

StandardDataFormats

 

 

Show:
© 2015 Microsoft