api.Stream.Get can't get recent results

Jul 26, 2010 at 3:38 PM

Hi everybody, to begin with, I'm a newbie in C# .Net world, and my coding a client for multiple social networks using WPF, but I'm having some trouble with Facebook particularly..

I'm using api.Stream.Get to fetch users wall. It's working, but I can't get recent updates on the wall. When I make the REST call using http://developers.facebook.com/docs/reference/rest/stream.get, it shows all results, but using api.Stream.Get I can't get posts that where sent last hour for example.

Does anyone knows why is this happening? Or should I be using another method for reading the wall?

Here is a snippet of my code (tips on how to improve this code are welcome too, since this is the first time I use c# and .net):

public void LoadWall()
        {
            Api api = new Api(session);
            System.Net.ServicePointManager.Expect100Continue = false;
            user user = null;

            var posts = api.Stream.Get(null, DateTime.Now.AddYears(-2), DateTime.Now, 30);

            foreach (var item in posts.posts.stream_post)
            {
                if (!usersHash.ContainsKey(item.actor_id))
                {
                    user = api.Users.GetInfo(Convert.ToInt64(item.actor_id));
                    usersHash.Add(item.actor_id, user);
                }
                else
                    user = usersHash[item.actor_id] as user;

                if (user != null && (downloaded_posts.IndexOf(item.post_id) == -1))
                {
                    _messages.Add(new SocialMessage
                    {
                        From = user.name,
                        FromImage = (user.pic != null) ? new Uri(user.pic) : null,
                        Text = item.message
                    });

                    downloaded_posts.Add(item.post_id);
                }
            }
        }