0

我的代码在这里遇到了问题,现在我在谷歌上搜索了大约 3 个小时。

我只是在做一个 FQL 查询,我正在尝试读取结果。但不幸的是。我不知道怎么做。

var fbclient = new FacebookClient(accessToken);

            dynamic result = (IDictionary<string, object>)fbclient.Get("fql", new
            {
                q = new[]
                {
                    "SELECT name FROM user WHERE uid = me()",
                    "SELECT unread_count FROM mailbox_folder WHERE folder_id = 4 AND viewer_id = me()",
                    "SELECT is_unread FROM notification WHERE recipient_id = me()",
                    "SELECT unread FROM friend_request WHERE uid_to = me()"
                }
            });

            string name = "";

            foreach (dynamic data in result.data)
            {
                name = data.name;
            }

最后一部分 ( foreach) 不起作用 - 只是我尝试的最后一件事。

4

1 回答 1

1

出色地。现在回答我自己的问题。花了一段时间,但我终于想出了如何从 FQL-Multi-Query 中获取信息。对于那些搜索相同的人:

dynamic result = fbclient.Get("fql", new
        {
            q = new[]
        {
            "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = me()",
            "SELECT is_unread FROM notification WHERE recipient_id = me()",
            "SELECT unread FROM friend_request WHERE uid_to = me()"
        }
        });

        var unread_messages = result["data"][0]["fql_result_set"][0]["unread_count"];
        var notifications = result["data"][1]["fql_result_set"];
        var open_friendRequests = result["data"][2]["fql_result_set"];

这就是我一直想要的;o)

此致,

丹尼

于 2013-05-02T15:57:55.040 回答