Home > DEV > Tweeting with TweetSharp

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 http://www.nuget.org/packages/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:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: