I’m trying to make a simple way to post a tweet to twitter, nothing more, nothing less. I cannot find a decent tutorial or documentation related to this… there is 10 libraries for it, can’t figure out how to use none of them, don’t even wan’t to bother with it to be honest I JUST WANNA POST… This is what I’m aiming for, still it is not working:
private void TweetBtn_Click(object sender, RoutedEventArgs e)
{
// Create a webclient with the twitter account credentials,which will be used to set the HTTP header or basic authentication
client = new WebClient { Credentials = new NetworkCredential { UserName = usernameTxtBox.Text, Password = password.Password } };
// Don't wait to receive a 100 Continue HTTP response from the server before sending out the message body
//ServicePointManager.Expect100Continue = false;
// Construct the message body
byte[] messageBody = Encoding.UTF8.GetBytes("status=" + messageTxtBox.Text);
// Send the HTTP headers and message body (a.k.a. Post the data)
client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
client.UploadStringAsync(new Uri("http://twitter.com/statuses/update.xml", UriKind.Absolute), messageTxtBox.Text);
}
Thanks in advance 🙂
If all you want is to share a message to Twitter, why not just use the ShareStatusTask?
You can check here a sample code on how to use it!