Get Facebook wall posts from fan page or group

风流意气都作罢 提交于 2019-12-08 07:35:53

问题


I use the facebook api wrapper from https://github.com/facebook/csharp-sdk, then I have created a facebook application and I use the Access Token from the facebook application but still I can't get the wall posts from a fan page I have created? It seems like I need to authenticate with a user even though I use the access token?


回答1:


The user always has to grant you permission to read his wall posts, there's only some basic information publicly available.




回答2:


If you're just accessing this one fan page, you have the options of using Facebook PowerShell Module, this is

PS C:\Windows\system32> Get-FBAssociation -id 219372234769562 -type Statuses 

id           : 245067728866679
message      : Jonatan Larsson, ägare och grundare till Kundo.se nämner BrickPile i veckans länktips http://lillbra.se/2011/08/veckans-lnktips-2011-08-14/
likes        : {@{id=611391282; name=Amanda Lägervik}, @{id=219372234769562; name=BrickPile}}
from         : @{id=219372234769562; name=BrickPile; category=Software}
updated_time : 2011-08-21T19:03:12+0000



回答3:


do you means to retrieve what others people post on your page right? i hope this solution can help you. Firstly ofcourse you needed the access token, then put this code in onclick button:

var fb = new FacebookClient(lblToken.Text);
    var query = string.Format(@"SELECT type, target_id, post_id, message, actor_id, tagged_ids 
                                FROM stream WHERE source_id =551183598322481 AND actor_id !=551183598322481");//sourceID & actorID here is your PAGE_ID 

    dynamic parameters = new ExpandoObject();
    parameters.q = query;
    dynamic results = fb.Get("/fql", parameters);

    List<MyPageStream> q = JsonConvert.DeserializeObject<List<MyPageStream>>(results.data.ToString());

    GridView1.DataSource = q;
    GridView1.DataBind();

Then outside the onclick button, put this code:

public class MyPageStream
    {
        public string post_id { get; set; }
        public string target_id { get; set; }
        public string type { get; set; }
        public string message { get; set; }
        public string actor_id { get; set; }
        //public long tagged_ids { get; set; } permalink
    }


来源:https://stackoverflow.com/questions/7066055/get-facebook-wall-posts-from-fan-page-or-group

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!