My goal is to be able to create an appointment through which a user can request to speak with a member of our team at a specific time, and that appointment is created as a Teams meeting, added to the team member's calendar and the invite sent to the requesting user.
My assumption was that the Bookings API would be a good way to do this, using the solutions/bookingBusinesses/myBookingType@my.organisation/appointments
endpoint. As the users could come from anywhere, it needed to have Application permissions and those were granted for Bookings.Read.All
and BookingsAppointment.ReadWrite
and then trying to create an appointment as described in the documentation here.
My problem is that every call I make- example being:
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/myBookingType@myOrganisation/appointments
Accept: application/json
Authorization: Bearer abcdefghi...xyz
Content-Type: application/json
{ "duration":"PT30M", "start_date_time":"2022-12-29T14:30:00+00:00", "staffMemberIds":["abcd-efgh-ijkl-mnop"], "isLocationOnline":true, "filedAttendeeCount":1, "reminders":[{"message":"Remember your appointment today", "offset":"PT120M", "recipients":"allAttendees"}], "customers": [{"name":"Custo Mer ", "emailAddress":"customer-email@organisation.com" }]}
Is coming back with a 401 response, no error code but the message "Authorization has been denied for this request."
and a couple of ids in the inner error message which trace through to a successful sign-in with no more information.
Now, I can't tell what is going on here, I'm in pure guesswork territory. Other answers seem to suggest that the only people who can create an appointment are users who are signed in creating the appointment for themselves, which seems like a completely backwards way to approach this and I think the application delegated permissions should circumvent it. However it does appear as though maybe I have to create the customer entity as a bookingCustomerInformation
object, before I can use it to create a bookingAppointment
- something which seemingly I cannot do through the API with Application permissions.
So my core question is: Is the BookingAppointment
the wrong approach to use if I want to book an appointment with one of the team? Should I be manually inserting an event into their calendar or something along those lines, instead?