Windows.ApplicationModel.DataTransfer.DataTransferManager

November 11, 2020 · View on GitHub

-description

Programmatically initiates an exchange of content with other apps.

-remarks

The DataTransferManager class is a static class that you use to initiate sharing operations. To use the class, first call the GetForCurrentView method. This method returns the DataTransferManager object that is specific to the active window. Next, you need to add an event listener for the datarequested event to the object. This event is fired when a sharing operation starts— typically when the user taps the Share charm, although it is also fired if your app starts a share operation programmatically.

The DataTransferManager class includes a ShowShareUI method, which you can use to programmatically start a share operation.

The DataTransferManager class also has a TargetApplicationChosen event. Use this event when you want to capture what applications a user selects when sharing content from your app.

Note

This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Windows Phone 8

This API is supported in native apps only.

Version history

Windows versionSDK versionValue added
160714393IsSupported
170315063ShareProvidersRequested
170916299ShowShareUI(ShareUIOptions)

-examples

This example shows a typical way of using the DataTransferManager object.

[!code-jsDataTransferManager_1]

-see-also

Sharing content source app sample (Windows 10)