Hello World to Twitter from C #

A few days ago, I posted this question and this question , asking about how to post a Hello World message to Twitter. I got helpful answers that pushed me further, but I'm still lost.

I need to use OAuth because (as I read it) using a username and password will soon become obsolete.

I need an example as simple as updating status with the string constant "Hello World!"

My client indicates that I should use C #.

+4
source share
5 answers

Definitely use Linq2Twitter -

http://linqtotwitter.codeplex.com/

The UpdateStatus method has 11 overloads - the whole implementation is really good. So you, for example, will:

var tweet = twitterCtx.UpdateStatus("Hello world"); 
+18
source

I would like to post this here since I had to work too long and this is what I consider the minimum requirement for Hello World Twitter using Linq2Twitter, now that OAuth is a must. I hope this will be useful to everyone who was on my page, but found that this did not solve their problem.

 using LinqToTwitter; var auth = new SingleUserAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = "yourConsumerKey", ConsumerSecret = "yourConsumerSecret", OAuthToken = "yourOAuthToken", AccessToken = "yourAccessToken" } }; var service = new TwitterContext(auth); var tweet = service.UpdateStatus("hello twitter"); 
+9
source

Which API are you using? Have you tried Twitterizer . It should be relatively simple.

+2
source

I highly recommend you use TweetSharp . It is very reliable, supports the scenario described above (uses OAuth for authentication).

I used it in several pet projects, and I was very pleased with it. The download comes with a sample WPF application that shows how to use the twitter OAuth implementation.

+2
source

I don't have enough reputation to comment on zithrey, but I also agree that the documentation related to running linq2twitter is corrupted and the project is loading with errors, which makes it impossible. Hope this helps someone - he uses PIN authorization

 static void Main(string[] args) { string ckey = "consumerkey"; string csecret = "consumersecret"; var auth = new PinAuthorizer() { Credentials = new InMemoryCredentials { ConsumerKey = ckey, ConsumerSecret = csecret }, GoToTwitterAuthorization = pageLink => Process.Start(pageLink), GetPin = () => { Console.WriteLine( "\nAfter authorizing this application, Twitter " + "will give you a 7-digit PIN Number.\n" ); Console.Write("Enter the PIN number here: "); return Console.ReadLine(); } }; auth.Authorize(); var twitterCtx = new TwitterContext(auth); twitterCtx.UpdateStatus("This status has been created from a C# console app!"); } 
+1
source

Source: https://habr.com/ru/post/1310504/


All Articles