Reputation: 5480
I am doing some research and can't seem to find a definitive way to query Twitter's API to get a user's tweets on WP8 using C#.
The twitter user isn't my own account and all I want to do is retrieve tweets and not post any tweets.
Do I therefore need to Authenticate myself/my app? Is the TweetSharp
library appropriate for my objective?
Upvotes: 0
Views: 2020
Reputation: 5480
I used the following example http://code.msdn.microsoft.com/wpapps/Twitter-Sample-using-f36bab75:
if (NetworkInterface.GetIsNetworkAvailable())
{
//Obtain keys by registering your app on https://dev.twitter.com/apps
var service = new TwitterService("abc", "abc");
service.AuthenticateWith("abc", "abc");
//ScreenName is the profile name of the twitter user.
service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = "the_appfactory" }, (ts, rep) =>
{
if (rep.StatusCode == HttpStatusCode.OK)
{
//bind
this.Dispatcher.BeginInvoke(() => { tweetList.ItemsSource = ts; });
}
});
}
else
{
MessageBox.Show("Please check your internet connestion.");
}
I created a new application user the twitter dev website: https://dev.twitter.com/user/login?destination=home. Once this was set-up, I essentially copied and pasted the keys within the AuthenticateWith
and TwitterService
methods.
I haven't solved exactly how I shall display the data but, at runtime, I can see data being passed in.
Upvotes: 2