Question

Using the facebook c# sdk I am able to read my feed data as follows

                    var fb = new Facebook.FacebookClient(longlifeaccess_token);
                    dynamic fbFeed = fb.Get("me/feed");

However, I need to only be able to detect new posts. How can I achieve this.?

Does the SDK the feed to be read between two datetimes?

Is there a way to set up a callback so that the SDK notifies my code when a new post is made?

Thanks.

Was it helpful?

Solution

I don't think you can setup such a callback, but you can iterate through the feed and extract posts until you encounter a previous post. You can detect this by saving the last saved post Id. Below is a shortened snippet of code that does that.

  foreach (var item in data)
  {
      var post = (IDictionary<string, object>)item;

      if (post["id"].ToString() == latestPostId)
      {
           end = true;
           break;                               
      }

      //App logic continues...

  }

Alternatively, you can use the "since" and "until" parameter, like so: "me/feed?until=10/01/2013" , which would give you the posts before 10/01/2013

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top