Search Statuses In A List

Oct 8, 2012 at 10:44 AM

Is it possible to search Statuses in a List?

The only method I've found to do it is the rather clumsy way of extracting all the users from a list, then adding this to the Query (code below).

The problem is there's a limit to its length, so if the List has more than around 20 users in, the Search fails.

                    var lists =
                    (from list in twitterCtx.List
                     where list.Type == ListType.Members &&
                     list.OwnerScreenName == strUser &&
                     list.Slug == strList
                     select list);


                    if (lists != null)
                    {

                        foreach (var user in lists)
                        {

                            for (int i = 0; i < user.Users.Count; i++)
                            {
                                if (strFrom != "")
                                {
                                    strFrom += " OR ";
                                }

                                strFrom += "from:" + user.Users[i].Identifier.ScreenName;
                            }

                        }

                    }


                    var queryResultsText =
                    from search in twitterCtx.Search
                    where search.Type == SearchType.Search &&
                         search.WordOr == strSearch &&
                         search.WithRetweets == false &&
                         search.IncludeEntities == true &&
                         search.Query == strFrom &&
                         search.PageSize == 100
                    select search;

Coordinator
Oct 8, 2012 at 11:37 AM

Hi,

Are you looking for something like this:

            var statusList =
                (from list in twitterCtx.List
                 where list.Type == ListType.Statuses &&
                       list.OwnerScreenName == "JoeMayo" &&
                       list.Slug == "dotnettwittterdevs" // name of list to get statuses for
                 select list)
                .First();

Here's the docs on that:

http://linqtotwitter.codeplex.com/wikipage?title=Reading%20List%20Statuses&referringTitle=Managing%20Lists

Joe

Oct 8, 2012 at 11:41 AM

Thanks for such a quick reply.

Unless I've misunderstood it, the code above will return all statuses from users in a particular list.

I was looking to return statuses with a specific search term, from users in a particular list.