My client would like me to use .NET to post to Twitter, and suggests that I use C#.
Q: How do I post "Hello World" to twitter using C#?
This post mentions a library called twitterizer. Isn't there a native way to do it without using a 3rd party library? (Maybe not since authentication is one of the requirements).
Just use this implemented wrapper for the Twitter API:
https://github.com/danielcrenna/tweetsharp
From: http://code-inside.de/blog-in/2009/04/23/howto-tweet-with-c/
There is even a DotNetRocks interview with the developers.
Yes, you can do it without any third-party library. See my IronPython sample posted on the IronPython Cookbook site that shows you exactly how. Even if you don't program in IronPython, the main part of the code that should get you started is repeated below and easy to port to C#:
Basically, this does an HTTP POST to http://twitter.com/statuses/update.xml with a single HTML FORM field called
status
and which contains the status update text for the account identified byusername
(andpassword
).I'd suggest reading up on the documentation on http://developer.twitter.com/start. It has all the information you will need.
I created a video tutorial showing exactly how to setup the application inside twitter, install an API Library using nuget, accept an access token from a user and post on that user's behalf:
Video: http://www.youtube.com/watch?v=TGEA1sgMMqU
Tutorial: http://www.markhagan.me/Samples/Grant-Access-And-Tweet-As-Twitter-User-ASPNet
In case you don't want to leave this page:
Twitter has its own API to do that