C# Twitter Extension

by aherrick 29. September 2008 15:06

I was looking for an easy solution to add Twitter to my blog, and decide to write a class extension to fit my needs.  With input from Fence Row Productions I came up with a class to easily grab your most recent tweet and display it on your blog.  The code will parse Twitter API to display your most recent Tweet.


Check out how I am currently using it.

Added two ASP.NET label controls "lblTweet" and "lblTweetInfo." Also added an image control "imgTweet."

Here is my current code behind file for my MasterPage.  The class constructor is your Twitter login name (twitter.com/you)

   imgTweet.ImageUrl = "~/pics/twitter_bird_32.png";

   Twitter t = new Twitter("andrew_herrick");
   this.lblTweet.Text = t.TweetStatus;
   this.lblTweetInfo.Text = 
        string.Format("<a href='{0}' target='NEW'>{1}</a> from {2}.", 
        t.TweetURL, t.TweetDateDiff, t.TweetSource);
 

Attached is the complete class. Let me know how it goes and enjoy!

Twitter.cs (4.65 kb)

Tags:

Comments

9/29/2008 9:16:06 PM #

trackback

Trackback from DotNetKicks.com

C# Twitter Extension

DotNetKicks.com

5/28/2009 8:13:18 AM #

bally

Hi ,
what is the best way to get the following information with Twitter API without getting Login Credentials for twitterUserA:

1)suppose I have a user called  twitterUserA
I want to get detailed information for people who are following him and his followers.

2)so i need Followersname, FollowerID, FollowersFollowerCount,FollowersFollowingCount,followersUpdates#,and other info if possible.


what is the fastest and best way to get information for a given twitter account without asking for twitter Log in  credentials (username and password)


thanks
Bally

bally United States



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen
Tweaked by ajondeck.NET

About the author

Andrew Herrick
I am a full time developer for Blue Horseshoe Solutions based out of Carmel, Indiana. I enjoy learning new technology and hope to give back with some of the cool things I pick up along the way.  Check me out on Stack Overflow!


Categories

None

Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008