While trying to share data(simple text) from my winjs App and when I click share charm , I have only the mail and an another personalized app as a share option(targets), I'm looking to share content on Facebook or Twitter from my metro app.
I have configured my People App by adding Facebook and Twitter accounts and I can see all Facebook posts and tweets.
How can I add People App to my share target to be displayed when I click the share charm?
I'm wondering if there is extra code that I must insert or anything else to be done?
Any Helpful advice please?
//this the function that allow me to share content from the share charm
function ShowandShareContract() {
Windows.ApplicationModel.DataTransfer.DataTransferManager.showShareUI();
var dataTransferManager = Windows.ApplicationModel
.DataTransfer
.DataTransferManager
.getForCurrentView();
dataTransferManager.addEventListener("datarequested", function (e) {
var request = e.request;
request.data.properties.title = "Debugmode";
request.data.properties.description = "Debugmode Share App";
request.data.setText("Hello from DebugMode App");
});
@Brahim
The trick with the Share Contract is that a Share Target (in your example, the People app) will only appear in the list of apps if it handles one or more of the types of data that your app (the Share Source) has supplied. Because you've only supplied the title, description, and text, my suggestion would be to try adding more data types.
The Sharing content source app sample, on the Windows Store app dev center, shows examples of the many types of data that can be shared. If you download and run this sample, you can test to see which are accepted by the People app (when I tried it, links were the only thing I was able to share successfully).
Keep in mind that the advantage of the Share contract is that you don't have to rely on just one app for sharing. In fact, the user is in control of which app receives the content, so it's in your best interest to provide your content in as many formats as possible (title, description, plain text, HTML, link, pictures if applicable, etc.), so that no matter what type of content the desired receiving app supports, it will be available to handle a sharing request for your app.
Hope that helps.
For more info on Windows Store app development, register for Generation App.