Wednesday, May 25, 2011

Working with friends and friend lists

To get a list of a user’s friends you can use two methods

1.    Get a list of all the friends for a use.
2.    Get a list of custom lists that the user has created and then view the friends for that particular list.

This is code from our unit testing but you can replace the testcontext.writeline with your preferred output method

Imports Branches.FBAPI
Dim SI As New SessionInfo("[access_token]"))
Dim Req As New Functions.Requests(SI)
 ' Get a list of a users friends
For Each [Friend] In Req.GetFriends
 ' Get a list of friend liss and then return the users for that list.
Getting Friend Lists
For Each FriendList In Req.GetFriendLists
       For Each [Friend] In Req.GetFriendList(
              TestContext.WriteLine("     " & [Friend].name)

No comments:

Post a Comment