Note that there are some explanatory texts on larger screens.

plurals
  1. POSharing from Windows Phone 8
    primarykey
    data
    text
    <p>I am working on a <strong>Windows Phone 8</strong> app and am trying to share content through the DataTransferManager. The Windows API documentation says it is supported in Windows Phone but when the <code>DataTransferManager.GetForCurrentView()</code> function is called I get an exception</p> <pre><code>System.NotSupportedException was unhandled by user code HResult=-2146233067 Message=Specified method is not supported. Source=Windows InnerException: </code></pre> <p>I have been searching for an answer and can't find anyone else with the same issue, any help would be appreciated. All samples on this topic seem to be Windows 8 specific, but Phone 8 does include these functions. Here's sample code from my app.</p> <pre><code> protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); dataTransferManager.DataRequested += new TypedEventHandler&lt;DataTransferManager, DataRequestedEventArgs&gt;(dataTransferManager_DataRequested); } private void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e) { DataPackage requestData = e.Request.Data; requestData.Properties.Title = "Share Text Example"; requestData.Properties.Description = "An example of how to share text."; requestData.SetText("Hello World!"); } private void Button_Tap_1(object sender, System.Windows.Input.GestureEventArgs e) { DataTransferManager.ShowShareUI(); } </code></pre> <p>Again, the exception is shown when the page loads on the <code>DataTransferManager.GetForCurrentView();</code> function so it doesn't get to the other lines, but included them anyway. I've tried adding/removing permissions and assemblies but must be missing something. I've also tried putting the function in different events (such as the onTap function) with the same results.</p> <p><strong>If anyone is interested in trying this on their own here is some documentation:</strong></p> <p><a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.applicationmodel.datatransfer.datatransfermanager.aspx" rel="noreferrer">DataTransferManager</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.datatransfermanager.datarequested.aspx" rel="noreferrer">DataRequested</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.datapackage" rel="noreferrer">DataPackage</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.datatransfermanager.getforcurrentview" rel="noreferrer">GetForCurrentView()</a></p> <p><strong>UPDATE</strong></p> <p>Although it may not be the best solution given the context of this question, I am implementing the Email/Sms/Link Tasks as described below rather than using the DataTransferManager. It seems that DataTransferManager may not be accessible in WP8 and although the tasks will take a number of different functions they seem to be the best way to perform the intended functionality.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload