SinceID parameter is ignored

Sep 2, 2012 at 7:33 PM
Edited Sep 2, 2012 at 7:39 PM

Hello

I'm starting to use this very nice API and I've found that for the queries that retrieve the tweets of an user the SinceID parameter is ignored.

This is the code

List<LinqToTwitter.Status> ownTweets = new List<LinqToTwitter.Status>();

                ulong sinceID = 0;
                var dateFrom=DateTime.Today.AddDays(-30);
                do
                {
                    int countBefore = ownTweets.Count();
                    if (sinceID == 0)
                        ownTweets.AddRange((from tweet in twitterCtx.Status
                                         where tweet.Type == StatusType.User
                                               && tweet.ScreenName == user.ScreenName
                                               && tweet.IncludeRetweets == true
                                         select tweet).ToList());

                    else
                        ownTweets.AddRange((from tweet in twitterCtx.Status
                                         where tweet.Type == StatusType.User
                                               && tweet.ScreenName == user.ScreenName
                                               && tweet.SinceID == sinceID
                                               && tweet.IncludeRetweets == true                                             
                                         select tweet).ToList());
                    int countNow = ownTweets.Count();

                    if (ownTweets.Last()!=null)
                        sinceID = Convert.ToUInt64(ownTweets.Last().StatusID);                    
                }
  
                while (ownTweets.Count() < 3200 && ownTweets.Last().CreatedAt > dateFrom);

After the first iteration of the loop the tweets loaded are always the same 20 tweets.

Does someone know what I'm doing wrong?

I'm using the current available versión of Linq2Twitter at Nuget.

Regards!

Sergio Navarro

Coordinator
Sep 3, 2012 at 5:51 AM

Hi Sergio Navarro,

Paging through timelines is not an obvious task and I've intended to blog about it.  Now I have a reason. :)  Here's a blog post that I published today on how to do this:

Working with Timelines with LINQ to Twitter.

Joe

Sep 3, 2012 at 6:40 PM

I got it with your post, now it works

Thank you