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

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.

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}

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.