0

I want to get mentions of a any user using linq to twitter api. I have a code which brings back the user time line, but I want to get only mentions of a user, one of the method that is Mention Timeline can only be used to get mentions for authenticatd user but I want to get for any user. How it is possible? Here is my code which return a user timeline, what modification require in it? Please help

 var mentions= await _twitterContext.Status
                     .Where(s => s.ScreenName== ScreenName && s.Type == StatusType.User && s.Count == 200)
                     .ToListAsync();
Ammar Khan
  • 2,565
  • 6
  • 35
  • 60

1 Answers1

1

The Twitter API doesn't expose an endpoint that allows you to get mentions for any user with a screen name. However, you can get the mentions if you are authorized by the user for whom you want to get mentions for. Here's an example:

        var tweets =
            await
            (from tweet in twitterCtx.Status
             where tweet.Type == StatusType.Mentions &&
                   tweet.ScreenName == "JoeMayo"
             select tweet)
            .ToListAsync();

        PrintTweetsResults(tweets);

The documentation for this is here:

http://linqtotwitter.codeplex.com/wikipage?title=Querying%20the%20Mentions%20Timeline&referringTitle=Making%20Status%20Queries%20and%20Calls

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60