Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion teams/teams-ps/teams/Remove-CsPhoneNumberAssignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
42 changes: 37 additions & 5 deletions teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ Set-CsPhoneNumberAssignment -Identity <String> -EnterpriseVoiceEnabled <Boolean>
```

## 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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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
Expand All @@ -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)