Forum Discussion
BUG with Microsoft Teams PowerShell Module 4.x.x for Auto Attendant Management
Dear Microsoft Community
I have a working PowerShell Script for toggling a Microsoft Teams Auto Attendant target between CallQueue or a ExternalPstn. Developed since PowerShell Module Version 2.0.0 up to Version 3.0.0.
The main part of the Script for updating the $AutoAttendant.DefaultCallFlow.Menu.MenuOptions is the following
$AutoAttendant = Get-CsAutoAttendant | Where-object {$_.Identity -eq $($Identity)}
$First = $AutoAttendant.DefaultCallFlow.Menu.MenuOptions | Select-Object -First 1
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
Switch ($Target)
{
"ApplicationEndpoint" {
$CallQueue = New-CsAutoAttendantCallableEntity -Identity $($ResourceAccount) -Type ApplicationEndpoint
$MenuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $($CallQueue) -DtmfRespons Automatic
($AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Add($($MenuOption))) | Out-Null
}
"ExternalPstn" {
$PhoneNumber = New-CsAutoAttendantCallableEntity -Identity "tel:$($Global:CurrentPhoneNumber.Line)" -Type ExternalPstn
$MenuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $($PhoneNumber) -DtmfRespons Automatic
($AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Add($($MenuOption))) | Out-Null
}
}
But since Microsoft Teams PowerShell Module Version 4.0.0 or current 4.2.0, i receive an error removing the first MenuOptions Entry at following script line $AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
Exception calling "Remove" with "1" argument(s): "Collection was of a fixed size."
At line:1 char:1
+ $AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NotSupportedException
is this a known Issues of the current PowerShell Module and what is the plan for a fix.
many thanks
Andy
6 Replies
- Hello
What does
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.isFixedSize shows?- Andre HagmannCopper Contributor
Dear Andres
$First = $AutoAttendant.DefaultCallFlow.Menu.MenuOptions | Select-Object -First 1
$First shows
ApplicationEndPoint
Action : TransferCallToTarget
DtmfResponse : Automatic
VoiceResponses :
CallTarget : Type = ApplicationEndpoint
Id = af1dc44d-22e3-4f3c-8e46-877650172514
Prompt :ExternalPstn
Action : TransferCallToTarget
DtmfResponse : Automatic
VoiceResponses :
CallTarget : Type = ExternalPstn
Id = tel:+41448041414
Prompt :The Error happend with following Command
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
with the working PS Module, the menOptions is now empty, so I can assign the new menuOption
- Hello
I was asking if you run
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.isFixedSize
(note the isFixedSize at the end), if it is, it is an array of fixed size and that means no items can be removed or added, maybe they changed this to a different kind of collection
see
https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist.fixedsize?view=net-6.0#:~:text=A%20collection%20with%20a%20fixed,size%20collection%20reflects%20those%20changes.