I've been looking for a solution to post to twitter from a wp7 app but have found very limited resources on the matter. Everything seems to be in either a different programming language (ex. PHP) or platform (ASP.NET), or is lacking documentation.
These questions did NOT work for WP7:
Post in Twitter using C# application
Twitter post API C#
Post Tweets to Twitter from FaceBook using ASP.Net C#
Are there any resources, code samples or posts that talk about how to get started with the Twitter API for WP7?
Also are there any particular libraries maybe that are well documented that support WP7?
Thanks.
One popular Twitter library for .Net is TweetSharp. They have a Windows Phone 7 compatible library they have a section which shows sample code for Windows Phone 7. The sample shows how to use the TweetSharp library to retrieve your mentions and post a sample tweet.
If TweetSharp isn't right for you check out the Twitter Libraries page .NET section on the Twitter Developers site for another library with Windows Phone compatablity.
There are a couple of complete twitter apps on codeplex
I think both of these also have some associated blogging/documentation which might help - e.g. http://samjarawan.blogspot.com/2010/10/building-real-windows-phone-twitter-app_07.html
The fastest and easiest way is to use Twitter's Tweet Button API. This will make the user leave the page but allows them to modify the tweet how they like. You might be able to make this a little cleaner by embedding a WebBrowser item in your form and making it visible on tweeting.
Here is the code I use:
public class ShareTwitter
{
// DOCS: http://dev.twitter.com/pages/tweet_button
private const string URL = "http://twitter.com/share?url={0}&via={1}&text={2}";
public static void Open(string link, string via, string text)
{
WebBrowserTask t = new WebBrowserTask();
t.URL = String.Format(URL, HttpUtility.UrlEncode(link), HttpUtility.UrlEncode(via), HttpUtility.UrlEncode(text));
t.Show();
}
}
I have similar classes for Facebook, ReadItLater and the Windows Phone email - let me know if you're interested in that also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With