DataRequest DataRequest DataRequest DataRequest DataRequest Class


Lets your app supply the content the user wants to share or specify a message, if an error occurs.

public : sealed class DataRequest : IDataRequest
struct winrt::Windows::ApplicationModel::DataTransfer::DataRequest : IDataRequest
public sealed class DataRequest : IDataRequest
Public NotInheritable Class DataRequest Implements IDataRequest
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The following code shows how to use the DataRequest object as part of setting the data on a DataPackage to share with another app.

//To see this code in action, add a call to ShareSouceLoad to your constructor or other
//initializing function.
private void ShareSourceLoad()
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);

private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Text Example";
    request.Data.Properties.Description = "An example of how to share text.";
    request.Data.SetText("Hello World!");
function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareTextHandler);

function shareTextHandler(e) {
    var request = e.request; = "Share Text Example"; = "A demonstration that shows how to share.";"Hello World!");


Your app receives a DataRequest object when a datarequested event occurs. With this object, your app can supply data to a target app by using a DataPackage object, use a deferral object to call a function, or inform the target app that an error occurred.


Data Data Data Data Data

Sets or gets a DataPackage object that contains the content a user wants to share.

Deadline Deadline Deadline Deadline Deadline

Gets the deadline for finishing a delayed rendering operation. If execution goes beyond that deadline, the results of delayed rendering are ignored.


FailWithDisplayText(String) FailWithDisplayText(String) FailWithDisplayText(String) FailWithDisplayText(String) FailWithDisplayText(String)

Cancels the sharing operation and supplies an error string to display to the user.

GetDeferral() GetDeferral() GetDeferral() GetDeferral() GetDeferral()

Supports asynchronous sharing operations by creating and returning a DataRequestDeferral object.