You can retrieve a list of posts using the GetTaskAsync method with the request « me/feed ». Once again, the GetTaskAsync method will return a dictionary with two entries: data and paging. The request « me/feed » will return a maximum of 25 posts.
[DataContract]
public class FeedResult
{
[DataMember(Name = "data")]
public List<FacebookPost> Posts { get; set; }
}
[DataContract]
public class FacebookPost
{
[DataMember(Name = "id")]
public string ID { get; set; }
[DataMember(Name = "from")]
public FacebookFriend User { get; set; }
[DataMember(Name = "story")]
public string Story { get; set; }
[DataMember(Name = "created_time")]
public DateTime Created { get; set; }
}
var feedx = await _client.GetTaskAsync<FeedResult>("me/feed");
- until: A Unix timestamp or date value that points to the end of the range of time-based data.
- since: A Unix timestamp or date value that points to the start of the range of time-based data.
- limit: number of individual objects that are returned in each page.
var parameters = new { since = "2012/12/30", until = "2012/12/31" };
var feed = await _client.GetTaskAsync<FeedResult>("/me/feed", parameters);
In the code snippet above, I use parameters to retrieve posts posted between December 30 and December 31.
Everything you need to build a great Facebook connected AppFacebook SDK for .NET is great. It helps you authenticate, retrieve and post data easily. Unfortunately, the SDK doesn’t include classes to represent a friend, a post or a place. You have to read the Facebook Graph API documentation to be aware of every objects you can query and every properties they contain. Below are some links that will probably help you build your applications:
- Create your Facebook applications.
- Graph API Explorer : makes it easy to test the API you want to use
- Graph API Getting Started Guide : everything you need to know about Facebook APIs, permissions and connections
- Graph API homepage : gives you a complete list of objects you can query
- GitHub forum about Facebook SDK for .NET
- Get started with Mobile Services
- Get started with data
- Get started with authentication
- Get started with push notifications
(END)