How can i get all my posts on my wall using facebook api ? RRS feed

  • Question

  • This is my class.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Facebook;
    namespace WebSite_Login_And_Browsing
        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; }
        class FacebookPosts
            static string accesstoken;
            //static string token = "2f89d691b5f39949cd04f0ef324db21f";
            static string token = "1186840401345424|GoJRCpMy7zbFtjyZLJgSZmhHiv1";
            static Facebook.FacebookClient fc = new FacebookClient();
            public static void AccessToken()
                accesstoken = "https://graph.facebook.com/oauth/access_token?client_id=1186840401345424&client_secret=a4908f181811a9231a979a1f59cf48cc&grant_type=client_credentials";
            public static void RetrievePosts()
                    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 result.data not in result
                    for (int i = 0; i < result.data.Count; i++)
                        Posts posts = new Posts();
                        posts.PostId = result.data[i].id;
                        if (object.ReferenceEquals(result.data[i].story, null))
                            posts.PostStory = "this story is null";
                            posts.PostStory = result.data[i].story;
                        if (object.ReferenceEquals(result.data[i].message, null))
                            posts.PostMessage = "this message is null";
                            posts.PostMessage = result.data[i].message;
                        posts.PostPicture = result.data[i].picture;
                        posts.UserId = result.data[i].from.id;
                        posts.UserName = result.data[i].from.name;
                catch (Exception)

    I changed the tokens a bit in my code so they will not be the real once.

    The first one that i'm not using now i found it in my app https://developers.facebook.com/apps in Settings > Advanced. I see there Client Token.

    The second token i'm using now i found it using the link "https://graph.facebook.com/oauth/access_token?client_id=1186840401345333&client_secret=a4908f181811a9231a979a1f59cf48df&grant_type=client_credentials";

    I surfed to this link and got the other token.

    Now using the second token i'm getting exception:

     (OAuthException - #2500) An active access token must be used to query information about the current user

    If i'm using the first token I'm getting: (OAuthException - #190) Invalid OAuth access token

    What i want to do is to get a List with all my posts on the wall from first time until now.

    • Moved by Kristin Xie Monday, December 28, 2015 6:23 AM
    Sunday, December 27, 2015 9:28 PM


  • Hi Chocolade1972,

    This forum is about the C# programming language, IDE, libraries, samples, and tools, as your issue is more related to the third product, it’s out of this forum support scope and you’d better post your issue to the corresponding forums for better support. Thank you for your understanding.

    According to your description above, I think the issue point is about the token, you’d better first search and learn how to get the right access token.

    Best Regards,

    Albert Zhang

    • Marked as answer by Chocolade1972 Monday, December 28, 2015 2:59 PM
    Monday, December 28, 2015 6:22 AM