0

I'm working on a WP8.1 Universal App and I try to use the facebook c# sdk.

I successfully login to facebook and now I want to make a simple query

I test this code (from here http://facebooksdk.net/docs/phone/howtos/run-fql-queries/)

private async void OnQueryButtonClick(object sender, RoutedEventArgs e)
{
    var fb = new Facebook.FacebookClient(this.loginButton.CurrentSession.AccessToken);
    var result = await fb.GetTaskAsync("fql",
        new
        { 
            q = "SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)" 
        });

    System.Diagnostics.Debug.WriteLine("Result: " + result.ToString());
}

But I get this error:

(OAuthException - #12) (#12) fql is deprecated for versions v2.1 and higher

Someone can give a sample of usage of GetTaskAsync ?

:-)

knight
  • 65
  • 2
  • 8
BigJim
  • 1
  • See [this](http://stackoverflow.com/questions/25256428/query-facebook-for-what-version-of-the-graph-api-is-being-used-can-be-used) and [this](http://stackoverflow.com/questions/25989171/facebook-graph-api-fql-is-deprecated-for-versions-v2-1-and-higher) – Yuval Itzchakov Jan 07 '15 at 10:24

1 Answers1

0
var fb - new FacebookClient(this.loginButton.CurrentSession.AccessToken);
fb.GetTaskAsync
(
    "fql",
    new
    { 
        q = "SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)" 
    }
).ContinueWith
(
    t=> 
    if(!t.IsFaulted) 
    {
        dynamic result = t.Result;
        System.Diagnostics.Debug.WriteLine("Result: " + result.ToString());
    }
);

I have not compiled the code above but this should work for a simple Async GetTask call. Note I recommend moving away from fql facebook api calls. FQL is going away with the next version of the Facebook Graph API (https://developers.facebook.com/docs/reference/fql/) batch queries work in place of complex FQL queries.