Teams – Auto Attendants – Add Holiday Call Settings With a Script

Teams Auto Attendants (AA) support “Holiday call settings” to manage how the incoming calls will be managed during bank holidays and similar situation.

The process for doing this in the Microsoft Teams admin Center is extremely slow and boring, so I thought to a way to script it

1) You are able to export holidays (just the dates, sadly) from an AA that you will use as a template to a CSV file (for an example I will use an AA with identity 0e20e80a-c570-462b-8622-9a71375312ac)

#Exports holidays from an AA
$bytes = Export-CsAutoAttendantHolidays -Identity 0e20e80a-c570-462b-8622-9a71375312ac     
[System.IO.File]::WriteAllBytes("C:\temp\Holidays.csv", $bytes)

The result will be a plain CSV file like the one in the picture below

(You are welcome in using this one with the Bank Holidays in England for 2021 https://modern-workplace.uk/?attachment_id=2181 )

2) You are able to import the file inside another AA (my destination AA has identity f093ff19-284e-4206-98c1-131631aa93de)

#Imports Holidays from a file
$bytes = [System.IO.File]::ReadAllBytes("C:\temp\Holidays.csv")
Import-CsAutoAttendantHolidays -Identity f093ff19-284e-4206-98c1-131631aa93de -Input $bytes

The result will be like the one in the picture below. A new call flow is now defined for each holiday (I had previously set, manually, New Year Day)

3) I will assume that you are going to perform the same action for all the holidays (eventually you can edit specific ones later) and that you will use the parameters of the first callflow[1] (in my case, New Year Day) for all the other call flows. Callflow[0] is usually allocated to the “Call flow afterhours”.

So,now, you have to save the AA in a variable

#Import AA in a variable
$test = get-csautoattendant -Identity f093ff19-284e-4206-98c1-131631aa93de

Note: I am assuming you have holidays from 2 to 8 to configure. Take a look to $test.callflows to see what your situation is. My test AA is in the image below

4) You can check if the Greetings and Menu are the ones you desire (for an example, I have

$test.callflows[1].Greetings

ActiveType : TextToSpeech
TextToSpeechPrompt : Please note that all company offices are closed now
AudioFilePrompt :

$test.callflows[1].menu

Name : Holiday call flow
Prompts :
MenuOptions : Action = DisconnectCall
DtmfResponse = Automatic
DialByNameEnabled : False
DirectorySearchMethod : None

5) the last step is to overwrite all the holidays with the desired greetings / menu and apply

#Copy callflow[1] greetings and menu to the other call flows
$num=2
for ($num=2 ; $num -le 8 ; $num++)
{$test.callflows[$num].menu = $test.callflows[1].menu                                                                                                                                                                    
$test.callflows[$num].Greetings = $test.callflows[1].Greetings}
#Applies the modifications to the AA
Set-CsAutoAttendant -Instance $test         

6) you can check the result with

$test = get-csautoattendant -Identity f093ff19-284e-4206-98c1-131631aa93de
$test.callflows

My final result is the one in the image below

So, to summarise, here is the full script

#Imports Holidays from a file
$bytes = [System.IO.File]::ReadAllBytes("Your file")
Import-CsAutoAttendantHolidays -Identity "target group ID" -Input $bytes

#Import AA in a variable
$test = get-csautoattendant -Identity "target group ID"

#Copy callflow[1] greetings and menu to the other call flows
$num=2
for ($num=2 ; $num -le 8 ; $num++)
{$test.callflows[$num].menu = $test.callflows[1].menu                                                                                                                                                                    
$test.callflows[$num].Greetings = $test.callflows[1].Greetings}

#Applies the modifications to the AA
Set-CsAutoAttendant -Instance $test
mm
About Fabrizio Volpe 92 Articles
I am an IT professional focused on Microsoft Teams, solution architect in Symity I have been awarded from Microsoft with the highly professional MVP award for Office Servers and Services: 2016 and 2017 Skype for Business: 2015 Lync Server 2013: 2014 Directory Services: 2011,2012 and 2013

2 Comments

  1. this is so very helpful – thank you! i want to be able to tweak several holiday greetings over multiple Auto Attendants (about 9 of each eventually) so this will come in handy for sure!!

Leave a Reply

Your email address will not be published.


*


Time limit is exhausted. Please reload CAPTCHA.