{"id":2172,"date":"2020-12-30T22:11:09","date_gmt":"2020-12-30T22:11:09","guid":{"rendered":"https:\/\/modern-workplace.uk\/?p=2172"},"modified":"2020-12-30T22:45:30","modified_gmt":"2020-12-30T22:45:30","slug":"teams-virtual-sbc-closing-azure-network-ports-warnings-for-azureloadbalancer-and-virtualnetwork-2","status":"publish","type":"post","link":"https:\/\/modern-workplace.uk\/?p=2172","title":{"rendered":"Teams &#8211; Auto Attendants &#8211; Add Holiday Call Settings With a Script"},"content":{"rendered":"\n<p style=\"font-size:18px\">Teams Auto Attendants (AA) support &#8220;Holiday call settings&#8221; to manage how the incoming calls will be managed during bank holidays and similar situation.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">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<\/p>\n\n\n\n<p class=\"has-medium-font-size\">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)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Exports holidays from an AA\n$bytes = Export-CsAutoAttendantHolidays -Identity 0e20e80a-c570-462b-8622-9a71375312ac     \n&#91;System.IO.File]::WriteAllBytes(\"C:\\temp\\Holidays.csv\", $bytes)\n<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">The result will be a plain CSV file like the one in the picture below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"150\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-1024x150.jpg\" alt=\"\" class=\"wp-image-2176\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-1024x150.jpg 1024w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-300x44.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-768x113.jpg 768w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-1536x225.jpg 1536w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-214235-2048x300.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">(You are welcome in using this one with the Bank Holidays in England for 2021 <a href=\"https:\/\/modern-workplace.uk\/?attachment_id=2181\" data-type=\"URL\" data-id=\"https:\/\/modern-workplace.uk\/?attachment_id=2181\">https:\/\/modern-workplace.uk\/?attachment_id=2181<\/a> )<\/p>\n\n\n\n<p class=\"has-medium-font-size\">2) You are able to import the file inside another AA (my destination AA has identity f093ff19-284e-4206-98c1-131631aa93de)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Imports Holidays from a file\n$bytes = &#91;System.IO.File]::ReadAllBytes(\"C:\\temp\\Holidays.csv\")\nImport-CsAutoAttendantHolidays -Identity f093ff19-284e-4206-98c1-131631aa93de -Input $bytes\n<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">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)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"644\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000-1024x644.jpg\" alt=\"\" class=\"wp-image-2175\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000-1024x644.jpg 1024w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000-300x189.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000-768x483.jpg 768w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Empty_1000.jpg 1185w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">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 &#8220;Call flow afterhours&#8221;.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">So,now, you have to save the AA in a variable<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Import AA in a variable\n$test = get-csautoattendant -Identity f093ff19-284e-4206-98c1-131631aa93de<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Note: I am assuming you have holidays from 2 to 8 to configure. Take a look to <em>$test.callflows<\/em> to see what your situation is. My test AA is in the image below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"705\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249-1024x705.jpg\" alt=\"\" class=\"wp-image-2177\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249-1024x705.jpg 1024w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249-300x207.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249-768x529.jpg 768w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212249.jpg 1093w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">4) You can check if the Greetings and Menu are the ones you desire (for an example, I have<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><em>$test.callflows[1].Greetings<\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size\">ActiveType : TextToSpeech<br>TextToSpeechPrompt : Please note that all company offices are closed now<br>AudioFilePrompt :<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><em>$test.callflows[1].menu<\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Name : Holiday call flow<br>Prompts :<br>MenuOptions : Action = DisconnectCall<br>DtmfResponse = Automatic<br>DialByNameEnabled : False<br>DirectorySearchMethod : None<\/p>\n\n\n\n<p class=\"has-medium-font-size\">5) the last step is to overwrite all the holidays with the desired greetings \/ menu and apply<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Copy callflow&#91;1] greetings and menu to the other call flows\n$num=2\nfor ($num=2 ; $num -le 8 ; $num++)\n{$test.callflows&#91;$num].menu = $test.callflows&#91;1].menu                                                                                                                                                                    \n$test.callflows&#91;$num].Greetings = $test.callflows&#91;1].Greetings}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#Applies the modifications to the AA\nSet-CsAutoAttendant -Instance $test         <\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">6) you can check the result with <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$test = get-csautoattendant -Identity f093ff19-284e-4206-98c1-131631aa93de\n$test.callflows<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">My final result is the one in the image below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"886\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442-1024x886.jpg\" alt=\"\" class=\"wp-image-2178\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442-1024x886.jpg 1024w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442-300x259.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442-768x664.jpg 768w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-30-212442.jpg 1132w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>So, to summarise, here is the full script<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Imports Holidays from a file\n$bytes = &#91;System.IO.File]::ReadAllBytes(\"Your file\")\nImport-CsAutoAttendantHolidays -Identity \"target group ID\" -Input $bytes\n\n#Import AA in a variable\n$test = get-csautoattendant -Identity \"target group ID\"\n\n#Copy callflow&#91;1] greetings and menu to the other call flows\n$num=2\nfor ($num=2 ; $num -le 8 ; $num++)\n{$test.callflows&#91;$num].menu = $test.callflows&#91;1].menu                                                                                                                                                                    \n$test.callflows&#91;$num].Greetings = $test.callflows&#91;1].Greetings}\n\n#Applies the modifications to the AA\nSet-CsAutoAttendant -Instance $test<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Teams Auto Attendants (AA) support &#8220;Holiday call settings&#8221; 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2183,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","twitterCardType":"","cardImageID":0,"cardImage":"","cardTitle":"","cardDesc":"","cardImageAlt":"","cardPlayer":"","cardPlayerWidth":0,"cardPlayerHeight":0,"cardPlayerStream":"","cardPlayerCodec":"","footnotes":""},"categories":[758,753,752,757],"tags":[762,759,751,77,755],"class_list":["post-2172","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-758","category-microsoft365","category-microsoft-teams","category-office-365","tag-microsoftteams","tag-microsoft-365","tag-microsoft-teams","tag-office-365","tag-teams"],"_links":{"self":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2172"}],"version-history":[{"count":5,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2172\/revisions"}],"predecessor-version":[{"id":2185,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2172\/revisions\/2185"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/media\/2183"}],"wp:attachment":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}