How to use fql.multiquery with C# SDK

我的未来我决定 提交于 2019-12-25 08:48:00

问题


I am using the facebook-c#-sdk with VB.

my code:

dim facebook As New FacebookApp()

dim queries as string=" ""2011-4-13"" : ""SELECT metric, value FROM insights WHERE object_id=173249789387842 AND metric='page_active_users' AND end_time=end_time_date('2011-4-13') AND period=period('day')"",""2011-4-14"" : ""SELECT metric, value FROM insights WHERE object_id=173249789387842 AND metric='page_active_users' AND end_time=end_time_date('2011-4-14') AND period=period('day')"""

dim oFQLResult As Object = facebook.Query(queries )

I get: Facebook.FacebookApiException: Parser error: unexpected '\' at position 0.

A single query works perfect. What is the correct way to do multiqueries?

Thanks!


回答1:


You might want to check out these nuget packages. (Samples are in C#)

Install-Package Facebook.Sample
Install-Package Facebook.Sample.Dynamic

Here is sample in C#.

        var query1 = "SELECT uid FROM user WHERE uid=me()";
        var query2 = "SELECT profile_url FROM user WHERE uid=me()";

        try
        {
            var fb = new FacebookClient(accessToken);

            var result = (IList<object>)fb.Query(query1, query2);

            var result0 = ((IDictionary<string, object>)result[0])["fql_result_set"];
            var result1 = ((IDictionary<string, object>)result[1])["fql_result_set"];
        }
        catch (FacebookApiException ex)
        {
            // Note: make sure to handle this exception.
            throw;
        }


来源:https://stackoverflow.com/questions/5802037/how-to-use-fql-multiquery-with-c-sharp-sdk

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