Utilizing the Workplace365/Trade 2016 REST API Calendaring

Utilizing the Workplace365/Trade 2016 REST API Calendaring On the subject of Messaging API’s there no extra complicated factor then calendaring, not solely as a result of most distributors implement issues just a little otherwise however Trade additionally has just a little legacy characteristic drag due to its size of time out there place and the difficulties in altering the expertise and human interplay with it. The brand new REST API provides yet one more window into calendaring on Workplace 365 and Trade 2016 with a significant safety profit over its predecessor which is the flexibility to have the ability to scope your software entry so it could possibly solely entry the Calendar folders in a Mailbox the place beforehand apps could have wanted to have Full Rights or impersonation rights on a Calendar. Additionally the brand new REST API lets you work together with Group Calendars (or Groups Calendar) so leveraging the brand new REST API to worth add to the adoption of those new options could be a price your whereas.

To Help Calendaring I’ve added 2 new cmdlets to the Exch-Relaxation module to deal with creating Appointments and Assembly and some different supporting cmdlets to create the information buildings essential to deal with every of the information varieties. I’ve a full documentation web page with examples on GitHub right here https://github.com/gscales/Exch-Relaxation/blob/grasp/Samples/CalendaringExamples.md

Calendaring Varieties

As I discussed in my opening there isn’t a extra complicated a factor then calendaring so lets look briefly on the converge I’ve added to this point within the Module

Making a Single Appointment within the default Calendar
Pretty primary factor to do you utilize the New-CalendarEventRest cmdlet to specify all of the properties you wish to set on this New Appointment
New-CalendarEventREST -MailboxName [email protected] -AcessToken $AccessToken -Begin ([DateTime]::Parse("2017-07-05 13:00")) -Finish ([DateTime]::Parse("2017-07-05 14:00")) -Topic "Name of Event"

Making a Single Appointment within the secondary Calendar

The brand new REST API lets you enumerate all of the calendars in a Mailbox and returns them as a flat checklist construction (moderately then a mother or father/baby like Mailboxes). To cater for creating appointments on Secondary Calendar’s (eg any calendar different then the default) I included a -CalendarName parameter which first finds the secondary calendar utilizing a filter primarily based on the DisplayName after which lets you create the appointment like within the first instance eg


New-CalendarEventREST -MailboxName [email protected] -AcessToken $AccessToken -Begin ([DateTime]::Parse("2017-07-05 13:00")) -Finish ([DateTime]::Parse("2017-07-05 14:00")) -Topic "Name of Event" -CalendarName 'Secondary calendar'

Making a Single Appointment on a Group Calendar

To create an Occasion on a Group (or Groups) Calendar the consumer your utilizing to entry the REST API have to be a member of that group in query and have the mandatory rights on that Calendar. To cater for the mandatory modifications to the REST Uri you must publish to for teams which includes first discovering the GroupId of the Group you wish to entry, I’ve added a -Group change and -GroupName parameter to the cmdlets. The cmdlets then will use a lookup of the group primarily based on its displayname to seek out the GroupId first after which POST to the Group calendar. (The organizer of the appointment you create on the Group Calendar turns into the Mailbox your posting as). Eg

#Creates a brand new all occasion for the fifth of July from 13:00-14:00 on the a gaggle calendar known as 'Powershell Module'
New-CalendarEventREST -MailboxName [email protected] -AcessToken $AccessToken -Begin ([DateTime]::Parse("2017-07-05 13:00")) -Finish ([DateTime]::Parse("2017-07-05 14:00")) -Topic "Name of Event" -group -groupname 'Powershell Module'

Making a Recurring Appointment

Appointment or Assembly Recurrence might be the toughest factor with regards to Calendaring for builders and admin to grasp as a result of there are such a lot of completely different permutations of recurrence (eg every day,weekly,yearly and so forth). Discussing this intimately would eat many pages and hours so  I’ve coated the fundamentals on https://github.com/gscales/Exch-Relaxation/blob/grasp/Samples/CalendaringExamples.md an instance of making a recurring appointment seems like

$days = @()
$days+"monday"
$Recurrence = Get-Recurrence -PatternType weekly -PatternFirstDayOfWeek monday -PatternDaysOfWeek $days -PatternIndex first -RangeType enddate -RangeStartDate ([DateTime]::Parse("2017-07-05 13:00")) -RangeEndDate ([DateTime]::Parse("2019-07-05 13:00"))
#Creates a brand new all day occasion for As we speak on the default calendar
New-CalendarEventREST -MailboxName [email protected] -AcessToken $AccessToken -Begin ([DateTime]::Parse("2017-07-05 13:00")) -Finish ([DateTime]::Parse("2017-07-05 14:00")) -Topic "Monday Meeting" -Recurrence $Recurrence

Conferences

A gathering from an API perspective is an appointment with Attendees, an Attendee might be Required, Non-compulsory or a Useful resource like a Assembly rooms. One of many issues the REST API cannot do which you are able to do in EWS is create Conferences with attendees and management whether or not Assembly invites are despatched or not (they may at all times be despatched in REST). To assist out with creation of the proper attendees construction I’ve included the New-Attendee cmdlet so it may be used like such to creating conferences with attendees

$Attendees = @()
$Attendees += (new-attendee -Title 'fred smith' -Tackle '[email protected]' -type 'Required')
$Attendees += (new-attendee -Title 'barney jones' -Tackle '[email protected]' -type 'Non-compulsory')

New-CalendarEventREST -MailboxName [email protected] -AcessToken $AccessToken -Begin ([DateTime]::Parse("2017-07-05 13:00")) -Finish ([DateTime]::Parse("2017-07-05 14:00")) -Topic "Name of Event" -Attendees $Attendees

If there’s something lacking or that you must do however cannot work out please publish a difficulty https://github.com/gscales/Exch-Relaxation/points on GitHub and I will add a pattern to exhibit it.

Coming Quickly

Protection for Free/Busy

The module is obtainable from the PowerShell Gallery https://www.powershellgallery.com/packages/Exch-Relaxation and the supply from Github
https://github.com/gscales/Exch-Relaxation

Tags:

Related Posts

Leave a Reply