Client API Powershell - get users corresponding to a list of user ids?


#1

I’m using the client API via Powershell and have this code thus far.

Get the team members for a team

$team = $octoRepo.Teams.FindByName(“Developers”)
$teamMemberIds = $team.MemberUserIds

Now that I have the team member Ids, how do I get the users with those Ids? Looking for an example.


#2

Ok, we found it via trial and error! I did not know PS had an “in” operator. Useful!

Get the team members for a team

$team = $octoRepo.Teams.FindByName(“Developers”)
$teamMemberIds = $team.MemberUserIds
$teamMembers = $octoRepo.Users.FindAll() | Where-Object {$_.Id -in $teamMemberIds}


(Daniel Fischer) #4

Hi Michael,

Thanks for the update! I’m glad to hear that you got this working. :slight_smile:

Please don’t hesitate to get in touch if you have any further questions or run into any issues.

Best regards,
Daniel