Get location and hometown from Facebook

Aug 22, 2014 at 4:29 PM
I got a list of all users in a group using (get-fbmember 123456789, example )

With the list of user I tried to catch location and hometown of each user. ( get-fbobjectdata -id 121212121 ), but he only brings some attributes.

I tried using the parameter -fields
PS C:\Users\FABIO> Get-FBObjectData -id 10000xxxxxxxx75 -Fields hometown
but he does not bring me the attribute, only the user id researched.

someone with some experience with this and can help me?


1) I started the session with the command ( new-fbconnection , and i typed my user and password )

2) list of fields:
Aug 24, 2014 at 4:23 AM
Thanks Fabio! I tried this and it seems to be working for me. A couple notes:
  • These properties return objects with Id and Name fields.
  • Not all users choose to allow friends to view these fields. In fact, I'm not sure default privacy settings enable this.
You should be able to retrieve this data for your own account. Please try that and follow up on this thread.


PS> Get-FBFriend -fields location,hometown

location                    hometown                    id                          UserId                    
--------                    --------                    --                          ------                    
@{id=110843418940484; na... @{id=104005829635705; na... 67xxxxx06                   67xxxxx06                 
@{id=107700485919398; na... @{id=112630055419785; na... 13xxxxxx40                  13xxxxxx40                

PS> Get-FBFriend -fields location,hometown | select -ExpandProperty location

id                                                      name                                                  
--                                                      ----                                                  
110843418940484                                         Seattle, Washington                                   
107700485919398                                         Mercer Island, Washington                             

PS> Get-FBFriend -fields location,hometown | select -ExpandProperty hometown

id                                                      name                                                  
--                                                      ----                                                  
104005829635705                                         Gothenburg                                            
112630055419785                                         Las Cruces, New Mexico                                

PS C:\windows\system32> Get-FBObjectData 67xxxxx06 -fields location,hometown

location                             hometown                             id                                  
--------                             --------                             --                                  
@{id=110843418940484; name=Seattl... @{id=104005829635705; name=Gothen... 67xxxxx06