Question

I am querying my home statuses. However I am finding that the ID for each tweet is not set.

        var auth = new MvcAuthorizer
        {
            CredentialStore = new SessionStateCredentialStore()
            {
                ConsumerKey = TwitterConfig.ConsumerKey,
                ConsumerSecret = TwitterConfig.ConsumerSecret,
                OAuthToken = TwitterConfig.AccessToken,
                OAuthTokenSecret = TwitterConfig.AccessTokenSecret
            }
        };

        var twitterCtx = new TwitterContext(auth);

        var tweets =
                await (from tweet in twitterCtx.Status
                where tweet.Type == StatusType.Home
                select tweet)
                .ToListAsync();

Why is the ID for the tweets not populated?

I noticed on the documentation page http://linqtotwitter.codeplex.com/wikipage?title=Status%20Entity that it states that the field is populated by the user and not by twitter. I am not sure what this means as the ID is returned by twitter.

My end result is actually going to be to get the oembed feed for each of these statuses, so if there is an easier way to achieve this then let me know.

Was it helpful?

Solution

The Tweet ID from Twitter will be in the StatusID Property of the Status Entity. Check that field in your tweets var.

I think the intent of the LinqToTwitter developer(s) might have been to allow the consumer (you / your code) to assign your own internal ID for the tweets. Can't think of any other reason why they'd have another ID field in the same Status Entity, confusing for sure. is as follows (see comment on this answer).

ID is an input on some queries and StatusID is output. This keeps the return values in Twitter's response from overwriting the callers input parameters.

-- Joe Mayo (LinqToTwitter Developer)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top