SetUri | setUri method

DataPackage.SetUri | setUri method

[SetUri may be altered or unavailable for releases after Windows 8.1. Instead, use ApplicationLink or WebLink.]

Sets the Uniform Resource Identifier (URI) that is contained in the DataPackage.

Syntax


dataPackage.setUri(value);

Parameters

value

Type: Windows.Foundation.Uri [JavaScript] | System.Uri [.NET] | Windows::Foundation::Uri [C++]

The URI that is contained in the DataPackage.

Remarks

This method sets the value for StandardFormats.Uri.

URI is one of the data types that the DataPackage object supports directly. See the StandardDataFormats class for information on other supported data types.

Examples

The following code sample demonstrates how an app can set the URI on a DataPackage object.


function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareLinkHandler);
}

function shareLinkHandler(e) {
        var request = e.request;
        request.data.properties.title = "Share Link Example";
        request.data.properties.description = "A demonstration that shows how to add a link (URI) to share.";
        request.data.setUri(new Windows.Foundation.Uri("http://www.fabrikam.com"));
}


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

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

Metadata

Windows.winmd

Attributes

[Deprecated()]

See also

DataPackage

 

 

Show:
© 2016 Microsoft