Lets your app supply the content the user wants to share or specify a message, if an error occurs.
Syntax
/* For information about creating or accessing this object, see Remarks. */
Attributes
- MarshalingBehaviorAttribute(Agile)
- MuseAttribute()
- VersionAttribute(NTDDI_WIN8)
Members
The DataRequest class has these types of members:
Methods
The DataRequest class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| FailWithDisplayText | Cancels the sharing operation and supplies an error string to display to the user. |
| GetDeferral | Supports asynchronous sharing operations by creating and returning a DataRequestDeferral object. |
Properties
The DataRequest class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read/write | Sets or gets a DataPackage object that contains the content a user wants to share. | |
| Read-only | Gets the deadline for finishing a delayed rendering operation. If execution goes beyond that deadline, the results of delayed rendering are ignored. |
Remarks
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.
Examples
The following code shows how to use the DataRequest object as part of setting the data on a DataPackage to share with another app.
function registerForShare() { var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView(); dataTransferManager.addEventListener("datarequested", shareTextHandler); } function shareTextHandler(e) { var request = e.request; request.data.properties.title = "Share Text Example"; request.data.properties.description = "A demonstration that shows how to share."; request.data.setText("Hello World!"); }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
|
|
Metadata |
|
Build date: 2/25/2013