Search code examples
apiwindows-phone-7twitteroauthtweets

Does anyone know a simple method for posting a tweet from within a WP7 app?


Im trying create a windows phone 7 application that allows the user to click a button and login to their twitter account and then using a text box send a basic tweet to their twitter account. Is there a simple method of doing this? Ive found a number of examples very hard to follow.

Thanks in Advance


Solution

  • Providing you have Twitter configured on the device, use the ShareStatusTask

    var tsk = new Microsoft.Phone.Tasks.ShareStatusTask();
    tsk.Status = "Hello world!";
    tsk.Show();
    

    This also allows the user to post to Facebook / Windows Live / other social networks. If you want to limit it to Twitter, you'll need to roll your own - possibly by launching a web browser to https://twitter.com/intent/tweet?source=webclient&text=your+encoded+message+text