DataPackage.SetUri(Uri) DataPackage.SetUri(Uri) DataPackage.SetUri(Uri) DataPackage.SetUri(Uri) DataPackage.SetUri(Uri) Method

Definition

Note

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.

public : void SetUri(Uri value)
void SetUri(Uri value) const;
public void SetUri(Uri value)
Public Sub SetUri(value As Uri)
dataPackage.setUri(value);

Parameters

value
Uri Uri Uri

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

Examples

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

public void ShareSourceLoad()
{
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);
}

void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Link Example";
    request.Data.Properties.Description = "An example of how to share a link.";
    var link = new Uri("http://www.fabrikam.com");
    request.Data.SetUri(link);
}
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"));
}

Remarks

This method sets the value for StandardFormats.Uri.

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