Archive for May, 2014

Tweeting with TweetSharp

I had the chance to try TweetSharp for tweeting and reading some tweets from an account…

I found it pretty simple to use. Obviously in order to use it you need to have a twitter account and you need to get the “KEYS” from Twitter  Developer Center….

This is the code to start using TweetSharp, btw that’s based on Auth 1.1 and TweetSharp 2.3.1

var oauth_consumer_key = “xxxxxxx”;
var oauth_consumer_secret = “xxxxxxX”;

var key = “xxxxxxX”;
var keysecret = “xxxxxxX”;

var service = new TwitterService(key, keysecret);
service.AuthenticateWith(oauth_consumer_key, oauth_consumer_secret);

var tweets = service.ListTweetsOnHomeTimeline( new ListTweetsOnHomeTimelineOptions ());

//foreach (var tweet in tweets)

Console.WriteLine( “Got tweets ” + tweets.Count() );

var testresult = service.SendTweet( new SendTweetOptions { Status = “test” + DateTime    .Now.ToShortTimeString() });
Console.WriteLine( “tweet sent”);
catch ( Exception xx)
Console.WriteLine( “error sending tweet ” +xx.Message );

Categories: DEV Tags: