On the subject of Microsoft Bookings and automation the documentation about API could be discovered right here, there’s additionally a PowerShell module, at first I didn’t understand how to connect with Bookings API and I’ve created a reserving mailbox with Trade On-line PowerShell with New-SchedulingMailbox BUT! don’t do it.
This New-SchedulingMailbox shouldn’t be a great way to create it – later I had some points after I was attempting to do modifications on the reserving useful resource utilizing API, see right here and right here.
Ther code to connect with the API is:
$TenantID = "<tenant>.onmicrosoft.com" $AccountName = "BookingAutomation@area.com" $Password = '<bookingautomationpassword>' $ClientId = "XXXXXXX-XXX-XXX-XXX-XXXXXXXXXXXXX" # "Reserving-GraphAPI" software ID</bookingautomationpassword></tenant> # Constants - Endpoints $AzureResourceURI = "https://login.microsoftonline.com/$($tenantID)/oauth2/token" $ResourceID = "https://graph.microsoft.com" # Assemble the Physique for the POST $Physique = "grant_type=password"` +"&username=" +$Accountname ` +"&client_id=" +$clientId ` +"&password=" +$Password ` +"&useful resource=" +[system.uri]::EscapeDataString($ResourceID) Write-Host "Getting the authorization token" # The outcome ought to include a token to be used with Graph $Response = Invoke-WebRequest -Uri $AzureResourceURI -Technique POST -Physique $Physique $ResponseJSON = $Response|ConvertFrom-JsonAfter connectig you should use this to create a Reserving with PowerShell module:
$NewBookingParams = @{ DisplayName = "FirstBooking" BusinessType = "IT Companies" WebSiteUrl = "https://www.area.com" SchedulingPolicy = @{ AllowStaffSelection = $false MaximumAdvance = "P30D" MinimumLeadTime = "P1D" } } $NewBooking = New-MgBookingBusiness @NewBookingParamsIncluding customers is straightforward, so I’ll simply share a means I’m making a service:
$NewServiceParams = @{ BookingBusinessId = $PrimarySmtpAddress DefaultDuration = "00:15:00" # quarter-hour period IsLocationOnline = $true MaximumAttendeesCount = 10 StaffMemberIds = $StaffMemberId #A workers member ID to be assigned to the service DisplayName = "15 min name" DefaultReminders = @{ Message = "Only a fast reminder that your service is comming up quickly." Offset = "P1D" #0 - All recipients, 2 - Buyer, 1 - Workers Recipients = "2" } } New-MgBookingBusinessService @NewServiceParams