In most cases we will have the UPN and the Email address to match, however, in some specific scenarios they won’t match.

This introduces a challenge if we need to obtain the user email address that belongs to a specific team. The Get-CsTeamUser will return the user UPN and not the user Email address.

With this in mind we created Get-UcTeamUsersEmail.

Email address is obtained by extracting the primary SMTP Address from the ProxyAddressess attribute in the Get-CsOnlineUser output:

$EmailAddress = (Get-csOnlineUser |Select-Object @{Name='PrimarySMTPAddress';Expression={$_.ProxyAddresses -cmatch '^SMTP:' -creplace 'SMTP:'}}).PrimarySMTPAddress

This means that we only need to be connected using the Microsoft Teams PowerShell Module.

Get-UcTeamUsersEmail cmdlet accepts the following parameters:

  • TeamName – Search by Team display name.
  • Role – This will filter the users by role and has the following options: Owner, User, Guest.

Please note that if we don’t specify a team then it will list all Teams and this can take some time. We will get a prompt to make sure that we want to do this:

Get-UcTeamUsersEmail is available since version 0.1.3 in UCLobbyTeams module.


One thought on “Get-UcTeamUsersEmail

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.