Share Status on Social Media in Windows Phone


Code to share Social Media Status or Links on sites in Windows Phone.

While creating an application for Windows Phone you might encounter across a requirement to share certain messages from your application to social media sites configured on the user's device. You can do it using a ShareStaus Task. The ShareStausTask class is defined as below. It is inherited from the ShareTaskBase class.

social.gif

A ShareStatus Task Launcher allows an application to launch a dialog that allows a user to share status messages on social network sites.
A status message can be shared as below:

ShareStatusTask shareStatusTask = new ShareStatusTask();
shareStatusTask.Status = "Hey I am Shared By DebugMode";
shareStatusTask.Show();


You may encounter other scenarios where you may need to share a HyperLink across Social Media sites from your application. You can do that using launcher ShareLinkTask.

The ShareLinkTask class is defined as below:

social1.gif

The ShareLink Task Launcher allows an application to launch a dialog that allows the user to share links in a social network site. A link can be shared as below:
 

ShareLinkTask shareLinkTask = new ShareLinkTask();
shareLinkTask.Title = "DebugMode";
shareLinkTask.LinkUri = new Uri("http://debugmode.net"UriKind.Absolute);
shareLinkTask.Message = "Post of DebugMode.";
shareLinkTask.Show();

These launchers will be launched only if the user has configured social media sites on their device. I hope this post is useful. 

Thanks for reading.

Similar Articles