SAS41 SAS41 - 1 year ago 68
C# Question

Retrieving Facebook Wall posts with Facebook SDK on C#

I've seen a couple of similar things but could not find what I was looking for, I am trying to retrieve wallposts, (like 10 last posts) using Facebook SDK, but so far all I could find is how to post on a wall or hove to log in and get public user data.

This is what I have so far code vise:

public void facebookClientSetup()
System.Windows.Forms.MessageBox.Show("WOOO STUFF is happening!");
var fbclient = new FacebookClient("Token|secret");
dynamic me = fbclient.Get("/me/feed");

foreach (dynamic post in

I have this but it doesnt seem to quite do it.

Am I missing something?
Is there another way to do this?

Answer Source

You can try as follows...hopefully it helps

class Posts
    public string PostId { get; set; }
    public string PostStory { get; set; }
    public string PostMessage { get; set; }
    public string PostPicture { get; set; }

    public string UserId { get; set; }
    public string UserName { get; set; }


            var client = new FacebookClient(token);
            dynamic result = client.Get("/me/posts");
            List<Posts> postsList = new List<Posts>();

            //all the posts and their information (like pictures and links) is strored in not in result

            for (int i = 0; i <; i++)
                Posts posts = new Posts();

                posts.PostId =[i].id;
                if (object.ReferenceEquals([i].story, null))
                    posts.PostStory = "this story is null";
                    posts.PostStory =[i].story;
                if (object.ReferenceEquals([i].message, null))
                    posts.PostMessage = "this message is null";
                    posts.PostMessage =[i].message;

                posts.PostPicture =[i].picture;
                posts.UserId =[i];
                posts.UserName =[i];


        catch (Exception)

if you want advanced options can tray FQL Here and Here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download