Export (0) Print
Expand All
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.

ShareOperation.Data | data property

Applies to Windows and Windows Phone

Contains a DataPackage object with the data that the user wants to share.

Syntax


var data = shareOperation.data;

Property value

Type: DataPackageView

Contains the data that the user wants to share.

Examples

The following example shows how to get the DataPackageView object from the data property. To use the code in this example, add event listener to your app to handle the activated event. Then put this code in the function that this event listener calls.


if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) {
    shareOperation = eventArgs.shareOperation;
    if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
        var output = document.createElement("div");
        var shareData = shareOperation.data.getText();
        output.innerText = shareData;
        document.body.appendChild(output);
        shareOperation.reportCompleted();
    }
}


Requirements

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.ShareTarget
Windows::ApplicationModel::DataTransfer::ShareTarget [C++]

Metadata

Windows.winmd

See also

ShareOperation

 

 

Show:
© 2014 Microsoft