Bearbeiten

Freigeben über


Remove-CsPhoneNumberAssignment

This cmdlet will remove/unassign a phone number from a user or a resource account (online application instance).

Syntax

Remove-CsPhoneNumberAssignment
      -Identity <String>
      -PhoneNumber <String>
      -PhoneNumberType <String>
      [<CommonParameters>]
Remove-CsPhoneNumberAssignment
      -Identity <String>
      -RemoveAll
      [<CommonParameters>]

Description

This cmdlet removes/unassigns a phone number from a user or resource account. The phone number continues to be available in the tenant.

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.

Note: In Teams PowerShell Module 4.2.1-preview and later we are changing how the cmdlet reports errors. Instead of using a result object, we will be generating an exception in case of an error and we will be appending the exception to the $Error automatic variable. The cmdlet will also now support the -ErrorAction parameter to control the execution after an error has occurred.

Examples

Example 1

Remove-CsPhoneNumberAssignment -Identity user1@contoso.com -PhoneNumber +12065551234 -PhoneNumberType CallingPlan

This example removes/unassigns the Microsoft Calling Plan phone number +1 (206) 555-1234 from the user user1@contoso.com.

Example 2

Remove-CsPhoneNumberAssignment -Identity user2@contoso.com -RemoveAll

This example removes/unassigns the phone number from user2@contoso.com.

Parameters

-Identity

The Identity of the specific user or resource account. Can be specified using the value in the ObjectId, the SipProxyAddress, or the UserPrincipalName attribute of the user or resource account.

Type:System.String
Position:named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PhoneNumber

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:".

Type:System.String
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PhoneNumberType

The type of phone number to unassign from the user or resource account. The supported values are DirectRouting, CallingPlan and OperatorConnect.

Type:System.String
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveAll

Unassigns the phone number from the user or resource account.

Type:Switch
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object

Notes

The cmdlet is available in Teams PowerShell module 3.0.0 or later.

The cmdlet is only available in commercial and GCC cloud instances.