Search code examples
c#.netlinq-to-twitter

How do I query for tweets from another user?


What would be the query to get the last 50 tweets from a given user (Ex:@Microsoft) using LinqToTwitter library?

I am authenticating as SingleUser since I was not able to authenticate with the application authentication.

 var auth = new SingleUserAuthorizer()
        {

            Credentials = new SingleUserInMemoryCredentials()
            {
                ConsumerKey = "Key"
                , ConsumerSecret = "Key"
                , TwitterAccessToken = "Key"
                , TwitterAccessTokenSecret = "key"
            }
            ,
            AuthAccessType = AuthAccessType.Write

        };

Solution

  • I'm authenticating with an OAuth token, but I don't think it should be any different. Have you tried something like this?

    var twitter = new LinqToTwitter.TwitterContext(auth);
    var tweets = twitter.Status
                        .Where(t => t.Type == LinqToTwitter.StatusType.User && t.ID == "Microsoft")
                        .OrderByDescending(t => t.CreatedAt)
                        .Take(50);