Handles the bulk of the work during a share operation. This includes the data that the user wants to share, setting or removing QuickLinks, and informing the system about the status of the operation.
Syntax
public sealed class ShareOperation : Object
Attributes
- MarshalingBehaviorAttribute(Standard)
- VersionAttribute(NTDDI_WIN8)
Members
The ShareOperation class has these types of members:
Methods
The ShareOperation class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| RemoveThisQuickLink | Removes the QuickLink from the list of QuickLinks that are available to the user. |
| ReportCompleted() | Specifies that the sharing operation is complete. |
| ReportCompleted(QuickLink) | Specifies that the sharing operation is complete. A QuickLink that the system can save as a shortcut for future sharing operations is included. |
| ReportDataRetrieved | Specifies that the app has acquired the content that the user wants to share. |
| ReportError | Specifies that an error occurred during the sharing operation. |
| ReportStarted | Specifies that the app has started to acquire the content that the user wants to share. |
| ReportSubmittedBackgroundTask | Specifies that the app has requested that the system allow the sharing operation to run as a background task. |
Properties
The ShareOperation class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Contains a DataPackage object with the data that the user wants to share. | |
| Read-only | A string that contains the ID of a QuickLink. |
Remarks
When a user selects your app as the target of a share action, an activated event fires. The object that this event sends to your app contains the instance of the ShareOperation class.
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).
Examples
The following example shows how to work with the ShareOperation object.
var shareOperation = eventObject.detail.shareOperation; if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) { shareOperation.data.getTextAsync().done(function (text) { // To output the text using this example, // you need a div tag with an id of "output" in your HTML file. document.getElementById("output").innerText = text; }, function (e) { displayError("Error retrieving Text format: " + e); } }); }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
- Sharing content source app sample
- Sharing content target app sample
- Quickstart: Sharing content (Windows Store apps using JavaScript and HTML)
- Quickstart: Sharing content (Windows Store apps using C#/VB/C++ and XAML)
- Quickstart: Receiving shared content (Windows Store apps using JavaScript and HTML)
- Quickstart: Receiving shared content (Windows Store apps using C#/VB/C++ and XAML)
Build date: 12/4/2012