开发者

How to get all events from a facebook Page

There are tons of StackOverflow answers about getting events from a facebook Page.

They all list a FQL query and I'm sure they all work great; but since I'm new to this I have no clue as to what context these queries are executed and how to even get far enough to use these queries.

Getting all events from a facebook Page should be pretty trivial. There should probably be a complete copy+paste solution in every language but I haven't been able to find it.

Ideally, I would like a step-by-step solution that works in javascript or C#.

This is pretty much what I want to do and I see no reason why this shouldn't work on a public Page (but it doesn't):

<script>
    FB.init({
        appId: "196804317007661", // the appId for the website I registered with FB
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true  // parse XFBML
    });
    FB.api({
        method: "fql.query",
        query: "SELECT eid, name FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = PublicPageIdGoesHere)"
    },
    function (response) {
        console.log(response);
});

So, anyone k开发者_开发技巧now of a plug-n-play way of getting this to work?


I know the example is in VB but I'm sure you can port it to C# no problem. Here is an example using the Branches FB API library.

Dim FB As New SessionInfo("[access_token]")
Dim Req = New Functions.Requests(FB)
Dim EL = Req.GetEvents("[PageID]")
For Each E In EL
    Response.Write(E.id)
    Response.Write(E.name)
Next

This assumes that you already have an access_token from FB. If not you can check out the authentication example on the api. It's .Net so you can use it with C#.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜