2
votes

I'm trying to share to Facebook from my app with a caption and a link to it in the store e.g. "Congratulations, you got 120 points" and under that a link to the store with a custom logo. At the moment when I try to share it just has the link to the store and the option to "add a message". Is there a way to set the text to what I want it to be rather than leaving the user type a message? I have attached a screenshot to explain what I'm talking about. shows current share format

Hope someone has done this before

here's my code so far:

 function share() {
    Windows.ApplicationModel.DataTransfer.DataTransferManager.showShareUI();
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareHandler);
}

function shareHandler(e) {
    var request = e.request;
    request.data.properties.title = "Share Example";
    request.data.properties.description = "A demonstration that shows how to share.";
    request.data.setUri(new Windows.Foundation.Uri("http://apps.microsoft.com/windows/app/christmas-gift-rescue/082fb89e-111a-4123-bd7f-3d11088a78cf"));
}

Thank you

1

1 Answers

1
votes

This is entirely up to the share target. The app which receives the shared data (the target) can decide what to do with any of those pieces. You might want to ask in the Facebook Developers group to see if anyone knows there. That said, there is another property that we always set, but I do not know if the Facebook app uses it:

request.data.setText("Some custom text to share");

Here's some information on setting up a share target, which if you read through you'll see how the target app simply sets up an activation hook specifically for sharing. All of the data that your app shares comes through the event object on a ShareOperation object which has a data property. That data property contains functions for getting all of the data you share.