Windows Phone: Sharing Content

If you writing an app and want to add some social sharing capabilities like posting link to Facebook or twitter. Your initial approach may be to go to and check out each of their api’s or to go to codeplex and search for a C# api someone’s written that makes the integration simpler. But right from that start Windows Phone has had a much simpler way of doing things.

The ShareLinkTask provides a simple way to post messages to any social network the user has registered on their phone. You don’t need to do anything with authorising your app with facebook etc which not only makes things easier for you, but your users are also pleased as they don’t have to worry about what you may be doing with their passwords.

It also only takes 4 lines of code. Simply create an instance of the ShareLinkTask, set the tile and message and call the show function:

1ShareLinkTask shareLinkTask = new ShareLinkTask();
2shareLinkTask.LinkUri = new Uri("");
3shareLinkTask.Message = "Check out this great blog";

As well as the ShareLinkTask there is also a ShareStatusTask and ShareMediaTask that can be used if you just want to post a status update or post and image.

1ShareStatusTask shareStatusTask = new ShareStatusTask();
2shareStatusTask.Status = "I'm developing a Windows Phone application!";
5ShareMediaTask shareMediaTask = new ShareMediaTask();
6shareMediaTask.FilePath = path;

Social media isn’t the only way of sharing content on a phone though, there is also email and sms. Both of these are just as easy to do as social media though:

For email use the EmailComposeTask

1EmailComposeTask emailComposeTask = new EmailComposeTask();
2emailComposeTask.Subject = "Awesome website";
3emailComposeTask.Body = "Foo bla bla";

And for SMS use the SmsComposeTask

1SmsComposeTask smsComposeTask = new SmsComposeTask();
3smsComposeTask.To = "2065550123";
4smsComposeTask.Body = "Try this new application. It's great!";

For more information have a look at the MSDN documentation:

Share Link Task -

Share Status Task -

Share Media Task -

Email Componse Task -

SMS Compose Task -