I am trying to send a simple status update (tweet) using linq to twitter. I can connect ok but when I send a tweet I get a return status of "faulted" using the following code.
public async Task Tweet(string text)
{
var auth = GetCredentials();
await auth.AuthorizeAsync();
var ctx = new TwitterContext(auth);
var tweet = ctx.TweetAsync(text);
if (tweet != null)
Console.WriteLine(tweet.Status);
}
My GetCredentials method is as follows:
private static SingleUserAuthorizer GetCredentials()
{
return new SingleUserAuthorizer
{
CredentialStore = new SingleUserInMemoryCredentialStore()
{
ConsumerKey = ####,
ConsumerSecret = ####,
AccessToken = ####,
AccessTokenSecret = ####,
}
};
}
To confirm I have created an app in twitter. The credentials are correct (or at least copied and pasted from twitter) and I have full permissions to post messages to the account in question.
You should await TweetAsync, like this:
Status tweet = await ctx.TweetAsync(text);
That still isn't going to fix your problem all the way and here's why: