得到粉丝页面或组的Facebook墙上帖 [英] Get Facebook wall posts from fan page or group

查看:203
本文介绍了得到粉丝页面或组的Facebook墙上帖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook API的包装从 https://github.com/facebook/csharp-sdk,然后我创建了一个Facebook应用程序,我用的是访问令牌从Facebook应用程序,但是我就是没有得到一个粉丝页面,我创建了墙上的帖子吗?好像我需要即使我使用访问令牌的用户验证?

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?

推荐答案

你是指获取别人人们贴在你的网页吗?我希望这个解决方案可以帮助您。
首先ofcourse您所需要的访问令牌,然后把这个代码的onclick按钮:

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();



随后的onclick按钮之外,把这个代码:

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
    }

这篇关于得到粉丝页面或组的Facebook墙上帖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆