Search code examples
twitterlinq-to-twitter

Twitter StatusId


I am using Linq2Twitter in my ASP.net Web Forms application to return recent user tweets

var tweets = await
   (from tweet in ctx.Status
      where (
         (tweet.Type == StatusType.User)
         && (tweet.ScreenName == screenName)
         && (tweet.ExcludeReplies == true)
         && (tweet.IncludeMyRetweet == false)
         && (tweet.Count == 10)
         && (tweet.RetweetCount < 1)
      )
      select tweet)
   .Take(count)
   .ToListAsync();

This seems to work well and I get the expected Json return, but...

When I try and construct a link to the original tweet...

“https://twitter.com/” + ScreenName + “/status/” + data.StatusId

I get a "Sorry, page does not exist error".

Upon investigation it appears that the returned StatusId is incorrect. For example, the returned StatusId is:

500244784682774500

When the actual tweet refers to:

500244784682774528

In other words, in this case, the StatusId seem to be 28 adrift.

Can anyone throw any light on what is happening/what I am doing wrong?

IThanks.


Solution

  • After some debugging I found that the ID returned to the LinqtoTwitter application was correct, the problem occurred either in the JSON converter or in JavaScript itself being unable to handle the unsigned-integer id value.

    The solution was to create a simple view model from the returned results (using an extension method against the LinqToTwitter.Status object) and passing that to the client instead of the whole data graph.