Automatic holiday schedule for Auto Attendant?

The next step from my automatic RGS holiday set was to see if it could be converted to work with Auto Attendant in Skype Online. Easier said than done.

In the Office 365 portal you set opening hours by creating a weekly reoccurring schedule like this:
aa
There is no way in the GUI to set a future date where the phone lines are closed. Tried going through every menu in the Skype Online portal, but no luck. My first thought was, there has to be a way to do it in PowerShell.
I looked up what commandlets that are available for Auto Attendant:
csonline

What first caught my attention, was the New-CsOnlineSchedule commandlet.
So the way you create a Schedule is you create a time range like this:
$timerange = New-CsOnlineTimeRange -Start 08:00 -End 16:00
Then you use this time range and set it to a weekly schedule like this:
schedule

Then I first thought that I could do something like this:
script

What this script does is that it goes trough each date in my holidaylist $holidays to check if one of those dates match todays date. If it gets a match, then it redefines one of the day variables, and sets the time range to the value of $vaule. The easiest was to create a range where the phones were open for one minute in the middle of the night to mark this as a day where the phone is closed. If this was set to a daily schedule it should automatically close the phoneline on holidays.

I tested to create a schedule, but it did not update the schedule in the GUI. After spinning my head around a little, it hit me. Off course, new-CsOnlineSchedule only creates a schedule but not sets it. The problem I then encountered was that there was no commandlet called Set-CsOnlineSchedule. I started going through the different commandlets, and found that inside New-CsOrganizationalAutoAttendant there was a parameter called Schedules.

When you create a new Auto Attendant by using New-CsOrganizationalAutoAttendant  you can set the schedule to be one created with New-CsOnlineSchedule. But I needed to set a schedule on a already created Auto Attendant, so I tried looking at the Set-CsOrganizationalAutoAttendant. The only parameter in that commandlet was Instance. From the commandlet example, you need to do it like this to change something:
setcommand

In the New-CsOrganizationalAutoAttendant documentation the Schedules parameter is described as a System.Collections.Generic.List. The script block should look like this:
generic

When running this, I got the following error:
error

As from my understanding this shows me that the Schedules parameter only can be created, but not edited. Even though you can read it out with this command:
get

After this I started going deep down the rabbit hole of PowerShell and .net, so I don’t remember how I found out this next thing. I found out that the assembly of the Schedules parameter was named Microsoft.Rtc.Management.Hosted.Online.Models.Schedule.

I tried to create a new variable out of this assembly, in a hope that I could create a schedule another way.
assembly

This was not possible.
Usually when you try to load an assembly, you could do it like this:
Add-Type -Path ‘c:\filer\Microsoft.Rtc.Management.Hosted.Online.Models.Schedule.dll
Tried looking in the PowerShell module folders on the computer, but did not find anything.

My question in the end:
Why haven’t Microsoft added the possibility to update the schedule?

Leave a comment