How to list my friends using FQL?

I am trying to list all the birthdays of my friends using the version of Facebook-SDK 6.1.4. When I use the code below (that is, without FQL, it works well, but I can not get the birthdays, just the name and identifier values).

var client = new FacebookClient(access_token); dynamic me = client.Get(myusername); client.IsSecureConnection = true; friendListData = client.Get("/" + me.id + "/friends?fields=name,id"); JObject job = JObject.Parse(friendListData.ToString()); 

So I tried using code with FQL and it throws an exception.

  var client = new FacebookClient(access_token); client.IsSecureConnection = true; dynamic me = client.Get(myusername); //var id = me.id; Facebook.JsonObject friendListData = new Facebook.JsonObject(); try { friendListData = (Facebook.JsonObject)client.Get("fql", new { q = new { name = "SELECT name, birthday, email, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' ORDER BY birthday_date" } }); } catch (FacebookOAuthException facebookAuth) { //"(OAuthException - #102) A user access token is required to request this resource." } 

What am I doing wrong?

+4
source share
2 answers

Check if the access_token parameter is set and print it, and then check it in the debugger.

To call FQL

This is based on general letters for months, in particular a, e and u. You can make strpos out of this to fit these.

SELECT name, birthday, email, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND (strpos(lower(birthday),"a") >=0 OR strpos(lower(birthday),"e") >=0 OR strpos(lower(birthday),"u") >=0) ORDER BY birthday_date

This should print all zeros since null does not contain letters (by definition, null, not the letters themselves)

+3
source

This is very easy with Windows PowerShell and http://facebookpsmodule.codeplex.com :

import-module facebook $ FB_DefaultExtendedPermissions + = "friends_birthday" New-FBConnection Get-FBFriends - field name, birthday | select name, birthday

I have to add "friends_birthday" to the default permissions list ...

0
source

All Articles