DataRequest.GetDeferral DataRequest.GetDeferral DataRequest.GetDeferral DataRequest.GetDeferral DataRequest.GetDeferral Method


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

public : DataRequestDeferral GetDeferral()
DataRequestDeferral GetDeferral() const;
public DataRequestDeferral GetDeferral()
Public Function GetDeferral() As DataRequestDeferral
var dataRequestDeferral = dataRequest.getDeferral();

An object that allows you to share or send content asynchronously.


The following sample shows how to get a DataRequestDeferral object by using the GetDeferral method.

void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    DataRequestDeferral deferral = e.Request.GetDeferral();
    e.Request.Data.Properties.Title = "Hello World!";
    e.Request.Data.Properties.Description = "This example shows how to share files and images.";
    if (this.dataPackageThumbnail != null)
        e.Request.Data.Properties.Thumbnail = this.dataPackageThumbnail;
function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareImageHandler);

function shareImageHandler(e) {
    var request = e.request; = "Share Image Example"; = "A demonstration that shows how to share an image.";
    var deferral = request.getDeferral();
    Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\smalllogo.png").then(function (thumbnailFile) { = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(thumbnailFile);
        return Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\logo.png");
    }).done(function (imageFile) {;
    }, function (err) {


The GetDeferral method allows your app to call a function during a share operation, so that your app can asynchronously generate the DataPackage object for the target app.

Use this method when you want to use an asynchronous function call to generate the DataPackage during a share operation. This function must return a DataPackage object within 200ms to prevent the operation from timing out. If your app shares content that takes more time to package, such as a collection of files or photos, don't use this method. Instead, use the SetDataProvider method to assign a delegate to a DataPackage and return that DataPackage to the target app.