Search code examples
c#.netwindows-store-appsdata-sharingcharms-bar

Unable to share data by mail with windows 8.1 charm bar


I'm currently testing some code exemple provided by microsoft on msdn to check how sharing content from application with the mail application in the charm bar.

The code that microsoft gives you looks like this :

private void RegisterForShare()
{
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.ShareTextHandler);
}

private void ShareTextHandler(DataTransferManager sender, DataRequestedEventArgs e)
{
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Text Example";
    request.Data.Properties.Description = "A demonstration that shows how to share text.";
    request.Data.SetText("Hello World!");
}

I call the function that register the view for sharing in the following method like it's asked in the tutorial :

public override void OnNavigatedTo(object navigationParameter, Windows.UI.Xaml.Navigation.NavigationMode navigationMode, Dictionary<string, object> viewModelState)
{
    SelectedContact = (Contact)navigationParameter;
    base.OnNavigatedTo(navigationParameter, navigationMode, viewModelState);
    RegisterForShare();
}

But when I'm opening Sharing in the charm bar and clicking on mail, a message telling me that something went wrong with the information that i'd like to share.

Error Screenshot

I've check all over the internet but I can't find any similar error.

So if someone got a hint about what went wrong ?

I'm using Visual Studio Professional 2013 with the Emulator to test my app.


Solution

  • That might be because you didn't set your account email in the Mail application.