Find Friends ID without friends.getUserObjects()

Jan 18, 2009 at 4:10 PM
Hi all
i need to find all user's friends ID
i can do it with fbservice.friends.getUserObjects() but unfortunatly this mehod returns al lot of informations that i don't need and it also reduces performance of my application
Any suggestion?
thank you
TheCoBe
Coordinator
Jan 19, 2009 at 1:42 PM
Edited Jan 19, 2009 at 1:42 PM
Try using the friends.get method. (http://wiki.developers.facebook.com/index.php/Friends.get)  The getUserObjects() method calls the friends.get() method under the covers and then calls the users object to get the additional data about the friends.

Let me know if this helps.

...Peter



Jan 24, 2009 at 12:11 PM
Perfect!
it works fine and fast now
thank you very much
bye
Mark
Jan 30, 2009 at 3:45 PM
Hey guys...

Can you post your code on how you got this working?

Thank you
Stew
Feb 13, 2009 at 11:29 PM
HI All
i'm sorry if i answer only now but i was out for works

This is my class for the facebook service

public

 

class FaceBookService

 

{

 

readonly FacebookService FBService = new FacebookService();
private string FACEBOOK_API_KEY = ConfigurationManager.AppSettings["APIKey"];
private string FACEBOOK_SECRET = ConfigurationManager.AppSettings["Secret"];

 

 

 

public FacebookService FBServiceApp()

 

{

 

HttpContext.Current.Session["APIKey"] = ConfigurationManager.AppSettings["APIKey"];
HttpContext.Current.Session["Secret"] = ConfigurationManager.AppSettings["Secret"];
FBService.ApplicationKey = FACEBOOK_API_KEY;
FBService.Secret = FACEBOOK_SECRET;
FBService.IsDesktopApplication =
false;
string sessionKey = HttpContext.Current.Session["facebook_session_key"] as String;
long userId = HttpContext.Current.Session["facebook_userId"] is long ? (long)HttpContext.Current.Session["facebook_userId"] : 0L;

 

 

// When the user uses the facebook login page, the redirect back here will will have the auth_token in the query params
string authToken = HttpContext.Current.Request.QueryString["auth_token"];
if (!String.IsNullOrEmpty(sessionKey))
{

 

 

// We have already established a session on behalf of this user
FBService.SessionKey = sessionKey;
FBService.uid = userId;
}
else if (!String.IsNullOrEmpty(authToken))
{

 

 

// This will be executed when facebook login redirects to our page
FBService.CreateSession(authToken);
HttpContext.Current.Session["facebook_session_key"] = FBService.SessionKey;
HttpContext.Current.Session["facebook_userId"] = FBService.uid;
HttpContext.Current.Session["facebook_session_expires"] = FBService.SessionExpires;
}

 

 

else // Need to login
{
HttpContext.Current.Response.Redirect(@"http://www.facebook.com/login.php?api_key=" + FBService.ApplicationKey + @"&v=1.0");
return null;
}
return FBService;

 

}

}


And this is how i obtain friend id in my pages

 

facebook.Components.

FacebookService fbservice = new FaceBookService().FBServiceApp();
IList<long> IListfriendsList = fbservice.friends.get();