diff --git a/teams/teams-ps/teams/Remove-CsPhoneNumberAssignment.md b/teams/teams-ps/teams/Remove-CsPhoneNumberAssignment.md index f8f0e355e6..00334c36f7 100644 --- a/teams/teams-ps/teams/Remove-CsPhoneNumberAssignment.md +++ b/teams/teams-ps/teams/Remove-CsPhoneNumberAssignment.md @@ -35,6 +35,9 @@ This cmdlet removes/unassigns a phone number from a user or resource account. Th Unassigning a phone number from a user or resource account will automatically set EnterpriseVoiceEnabled to False. +If the cmdlet executes successfully, no result object will be returned. If the cmdlet fails for any reason, a result object will be returned that contains a Code string parameter +and a Message string parameter with additional details of the failure. + ## EXAMPLES ### Example 1 @@ -67,7 +70,8 @@ Accept wildcard characters: False ``` ### -PhoneNumber -The phone number to unnassign from the user or resource account. Supports E.164 format and non-E.164 format. +The phone number to unassign from the user or resource account. Supports E.164 format and non-E.164 format. Needs to be without the prefixed "tel:". + ```yaml Type: System.String diff --git a/teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md b/teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md index 68e1b9330b..a1a4a2e212 100644 --- a/teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md +++ b/teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md @@ -31,7 +31,13 @@ Set-CsPhoneNumberAssignment -Identity -EnterpriseVoiceEnabled ``` ## DESCRIPTION -This cmdlet assigns a phone number to a user or resource account. +This cmdlet assigns a phone number to a user or resource account. When you assign a phone number the EnterpriseVoiceEnabled flag is automatically set to True. + +To remove a phone number from a user or resource account, use the [Remove-CsPhoneNumberAssignment](Remove-CsPhoneNumberAssignment.md) cmdlet. + +If the cmdlet executes successfully, no result object will be returned. If the cmdlet fails for any reason, a result object will be returned that contains a Code string parameter +and a Message string parameter with additional details of the failure. + ## EXAMPLES @@ -67,6 +73,22 @@ Set-CsPhoneNumberAssignment -Identity cq1@contoso.com -PhoneNumber +14255551225 ``` This example assigns the Direct Routing phone number +1 (425) 555-1225 to the resource account cq1@contoso.com. +### Example 6 +```powershell +Set-CsPhoneNumberAssignment -Identity user4@contoso.com -PhoneNumber "+1425551000;ext=100" -PhoneNumberType DirectRouting +``` +This example assigns the Direct Routing phone number +1 (425) 555-1000;ext=100 to the user user4@contoso.com. + +### Example 7 +```powershell +$pn=Set-CsPhoneNumberAssignment -Identity user5@contoso.com -PhoneNumber "+1425551000;ext=100" -PhoneNumberType DirectRouting +$pn +Code Message +---- ------- +BadRequest Telephone Number '+1425551000;ext=100' has already been assigned to another user +``` +In this example the assignment cmdlet fails, because the phone number "+1425551000;ext=100" has already been assigned to another user. + ## PARAMETERS @@ -102,7 +124,7 @@ Accept wildcard characters: False ``` ### -LocationId -The Id of the location to assign to the specific user. You can get it using Get-CsOnlineLisLocation. If you want to remove the location, use +The LocationId of the location to assign to the specific user. You can get it using Get-CsOnlineLisLocation. If you want to remove the location, use the string value null. ```yaml @@ -117,8 +139,9 @@ Accept wildcard characters: False ``` ### -PhoneNumber -The phone number to assign to the user or resource account. Supports E.164 format like +12065551234 and non-E.164 format like 12065551234. We are also supporting -Direct Routing numbers with extensions using the formats +1206555000;ext=1234 or 1206555000;ext=1234 +The phone number to assign to the user or resource account. Supports E.164 format like +12065551234 and non-E.164 format like 12065551234. The phone number can not have +"tel:" prefixed. We support Direct Routing numbers with extensions using the formats +1206555000;ext=1234 or 1206555000;ext=1234. + Setting a phone number will automatically set EnterpriseVoiceEnabled to True. @@ -134,7 +157,9 @@ Accept wildcard characters: False ``` ### -PhoneNumberType -The type of phone number to assign to the user or resource account. The supported values are DirectRouting, CallingPlan and OperatorConnect. +The type of phone number to assign to the user or resource account. The supported values are DirectRouting, CallingPlan, and OperatorConnect. When you acquire a phone number + +you will typically know which type it is. ```yaml Type: System.String @@ -161,5 +186,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES The cmdlet is available in Teams PS module 2.6.1-preview or later. +If a user or resource account has a phone number set in Active Directory on-premises and synched into Microsoft 365, you can't use Set-CsPhoneNumberAssignment to set the phone +number. You will have to clear the phone number from the on-premises Active Directory and let that change sync into Microsoft 365 first. + +The previous command for assigning phone numbers to users Set-CsUser had the parameter HostedVoiceMail. Setting HostedVoiceMail for Microsoft Teams users is no longer +necessary and that is why the parameter is not available on Set-CsPhoneNumberAssignment. + + ## RELATED LINKS [Remove-CsPhoneNumberAssignment](Remove-CsPhoneNumberAssignment.md)