Skip to content

Commit ffd1f43

Browse files
authored
Merge pull request #11250 from pavellatif/pavelup1
Update Set-CsPhoneNumberAssignment.md
2 parents d4c36bb + 06a69ea commit ffd1f43

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

teams/teams-ps/teams/Set-CsPhoneNumberAssignment.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,29 @@ Set-CsPhoneNumberAssignment -PhoneNumber +12065551224 -LocationId $loc.LocationI
110110
```
111111
This example shows how to set the location on a phone number.
112112

113+
### Example 10
114+
```powershell
115+
$OldLocationId = "7fda0c0b-6a3d-48b8-854b-3fbe9dcf6513"
116+
$NewLocationId = "951fac72-955e-4734-ab74-cc4c0f761c0b"
117+
# Get all phone numbers in old location
118+
$pns = Get-CsPhoneNumberAssignment -LocationId $OldLocationId
119+
Write-Host $pns.count numbers found in old location $OldLocationId
120+
# Move all those phone numbers to the new location
121+
foreach ($pn in $pns) {
122+
Try {
123+
Set-CsPhoneNumberAssignment -PhoneNumber $pn.TelephoneNumber -LocationId $NewLocationId -ErrorAction Stop
124+
Write-Host $pn.TelephoneNumber was updated to have location $NewLocationId
125+
}
126+
Catch {
127+
Write-Host Could not update $pn.TelephoneNumber with location $NewLocationId
128+
}
129+
}
130+
Write-Host (Get-CsPhoneNumberAssignment -LocationId $OldLocationId).Count numbers found in old location $OldLocationId
131+
Write-Host (Get-CsPhoneNumberAssignment -LocationId $NewLocationId).Count numbers found in new location $NewLocationId
132+
```
133+
This Example shows how to update the LocationID from an old location to a new location for a set of phone numbers.
134+
135+
113136
## PARAMETERS
114137

115138
### -AssignmentCategory

0 commit comments

Comments
 (0)