Downloading data of all followers

Oct 6, 2013 at 1:06 AM
Hello,
I am creating an application on WP8 that requires the data (profile picture, username, screen name, relationship, etc.) of all the user's followers. So far, I have the user IDs of all the followers, but I don't know how to get any other data from each id.
                (from follower in AppData.TwitterCtx.SocialGraph
                 where follower.Type == SocialGraphType.Followers && follower.UserID == ulong.Parse(ThisUser.Identifier.UserID)
                 select follower).MaterializedAsyncCallback(resp =>
                    {
                        if (resp.Status != TwitterErrorStatus.Success)
                        {
                            //handle errors
                        }
                        else
                        {
                            FollowerIDs = resp.State.FirstOrDefault().IDs;
                            Dispatcher.BeginInvoke(() =>
                                {
                                    List<UserDisplay> users = new List<UserDisplay>();
                                    foreach (string id in FollowerIDs)
                                    {
                                        users.Add(new UserDisplay() { Username = "test", ScreenName = "testname", Following = true, ProfilePictureSource = "/Assets/ApplicationIcon.png" });
                                    }
                                    lstFollowers.ItemsSource = users;
                                });
                        }
                    });
UserDisplay is a custom control I created, which displays the user's username, screen name, profile picture, and following relationship. Now I just need the actual values to plug into the code.
I'm new to Linqtotwitter, so I'm still trying to figure out how to use everything.

Thanks for your help!
Elliott
Coordinator
Oct 7, 2013 at 12:57 AM
Hi Elliott,

If you're only getting one user, you could do a User/Show query. However, for multiple users, a User/Lookup query would be more efficient because you can add multiple users in a single query and get a whole list back at one time.

@JoeMayo
Oct 7, 2013 at 4:32 AM
Hello Joe,
Thank you for your assistance! User/Lookup is the query I was looking for.
However, as I am on Windows Phone, an InvalidOperationException is thrown, saying, "Silverlight and Windows Phone applications require async queries." So I'm not quite sure how to integrate the User/Lookup query into my code, fetching data of all the UserIDs found from my code sample above.

Also, how would one go about using cursors to fetch all of the followers if the user had, say, 300, as User/Lookup only allows 100 at a time? Again, since I am on Windows Phone, I am required to use async queries, which cause issues when I try to integrate cursors.

If you could give me an example of how I would go about finding the LinqToTwitter.User value for each of my followers from a Windows Phone, that would be great!
Thanks!
Elliott