How to get LAST MENTIONS

Jan 21, 2010 at 10:35 AM

Hi guys,

Please, I need get last mentions since the last check.

Per example:

I get my mentions e the last sent mention was in 20 / Jan / 2010 12:06:58

Now I need get mentions send after 20 / Jan / 2010 12:06:58

 

[]´s

Coordinator
Jan 22, 2010 at 5:04 AM
Edited Jan 22, 2010 at 5:04 AM

Hi,

There isn't an option for date, but there is for SinceID.  The SinceID parameter will give you all of the tweets since the specified status ID.  Here's how it works:

            var myMentions =
                from mention in twitterCtx.Status
                where mention.Type == StatusType.Mentions
                    && mention.SinceID == 7841796067
                select mention;

Hope this helps,

Joe

Jan 22, 2010 at 10:29 AM

Joe,

 

Thank's!!!

This value (SinceID) I can store to in next "sync" I take news mentions?

This query return that number of mentions? Only 20? How to get more 20 results?

[]´s

Jan 22, 2010 at 6:50 PM
Joe,

Thanks.

This value (SinceID) I can store to in next "sync" I take news mentions?
This query return that number of mentions?

[]´s

Juliano Oliveira
Analista Desenvolvedor
twitter: @juloliveira - skype: juloliveira


2010/1/22 JoeMayo <notifications@codeplex.com>

From: JoeMayo

Hi,

There isn't an option for date, but there is for SinceID.  The SinceID parameter will give you all of the tweets since the specified status ID.  Here's how it works:

            var myMentions =
                from mention in twitterCtx.Status
                where mention.Type == StatusType.Mentions
                    && mention.SinceID == 7841796067
                select mention;

Hope this helps,

Joe

Read the full discussion online.

To add a post to this discussion, reply to this email (LinqToTwitter@discussions.codeplex.com)

To start a new discussion for this project, email LinqToTwitter@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Jan 24, 2010 at 2:20 AM
Edited Jan 24, 2010 at 2:22 AM

Yes, storing the last SinceID will allow you to get the newest.  About the number, there isn't any count of all the results, but here's an example on how to page through the results and accumulate the count:

        private static void MentionsWithPagingQueryDemo(TwitterContext twitterCtx)
        {
            bool hasMoreTweets;
            int page = 1;

            do
            {
                var myMentions =
                    (from mention in twitterCtx.Status
                     where mention.Type == StatusType.Mentions
                        && mention.Page == page
                     select mention)
                     .ToList();

                hasMoreTweets = myMentions.Count > 0;
                if (hasMoreTweets)
                {
                    Console.WriteLine("\n*** Page {0} ***\n", page); 

                    myMentions.ForEach(
                        mention => Console.WriteLine(
                            "Name: {0}, Tweet[{1}]: {2}\n",
                            mention.User.Name, mention.StatusID, mention.Text));
                }

                page++;

            } while (hasMoreTweets);
        }

Notice how I checked the count of the current iteration through myMentions.Count, which is the materialized List<Status> from the query.

Joe