Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Fields #4

Closed
xdansmith opened this issue Oct 5, 2017 · 23 comments
Closed

Custom Fields #4

xdansmith opened this issue Oct 5, 2017 · 23 comments

Comments

@xdansmith
Copy link

Bookings supports defining custom fields for different services.

Is this supported by the API currently?

@fpintos
Copy link
Member

fpintos commented Oct 5, 2017

At this moment the API does not yet expose the custom fields.
We'll keep this issue open and then close it when we update the service with that feature.

@fpintos fpintos self-assigned this Oct 5, 2017
@xdansmith
Copy link
Author

I also noticed these don't show in Outlook either - are there plans to expose this information in Outlook in the near future?

@fpintos
Copy link
Member

fpintos commented Oct 11, 2017

It is an interesting suggestion to post in UserVoice:
https://outlook.uservoice.com/forums/314907-microsoft-bookings

@xdansmith
Copy link
Author

@fpintos Any update regarding adding support for Custom Fields to the API?

@fpintos
Copy link
Member

fpintos commented Dec 13, 2017

Not yet, but it is in the plans.

@chotimir
Copy link

@fpintos Any updates?

@fpintos
Copy link
Member

fpintos commented Jun 25, 2018

Unfortunately, no change on this yet.
However, the raw data is available in the underlying event where booking appointment data is stored, so it is possible to get to it.
See the comments in this issue, #7, and you'll find the name of the properties; it relies on getting an /event using extended properties, but at least it unlocks the data.

@moisesynfam
Copy link

Is it possible to the get the custom fields from a service so i can add them to a custom form ?

@fpintos
Copy link
Member

fpintos commented Jan 29, 2019

I'll forward this request to the feature team. Last time I checked the API didn't expose custom fields yet.

@willensoll
Copy link

willensoll commented Jul 8, 2019

+1

This would make a huge difference to our use case.

@Tronald
Copy link

Tronald commented Sep 14, 2020

Any progress on this? Those custom fields are pretty important to be able to call. If the user is creating fields, it's because the info is needed. Would love to have this feature.

@Tronald
Copy link

Tronald commented Sep 15, 2020

Just a heads up for anyone needing to access the custom questions. I spent a long time going down this rabbit hole as it was new to me so I figured I would share my experience to save others time. The fields cannot currently be called via the bookings API, but they can be called using extended events within the Calendar API as stated by @fpintos . This isn't ideal, but it can work for many use cases.

For example:

After you have successfully called the bookings appointment, you could extract the appointment id. Using that id you could call the calendar event with extended events.

//{calendarID} = Same as your bookings calendar ID
//{eventID} = the bookings appointment id


https://graph.microsoft.com/v1.0/users/{calendarID}/events/{eventID}?$expand=singleValueExtendedProperties($filter%3Did eq 'Binary {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemAnsweredCustomQuestions')

The key is in the expand call. A couple things to note with this.

  1. Some examples show $filter=id eq but this will actually fail. The = needs to be replaced with %3D. Example: filter%3Did eq
$expand=singleValueExtendedProperties($filter%3Did eq 'Binary {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemAnsweredCustomQuestions')
  1. Call the extended properties in the api call first. I noticed if I put it after things such as date parameters it fails.

  2. The GUID being passed is specified as a Binary meaning the the custom questions/answers will return in base64 encoded bytes. You will need to decode this to get the json value.

var base64EncodedBytes = Convert.FromBase64String(val);
string json = Encoding.UTF8.GetString(base64EncodedBytes);
  1. Other bookings properties can be obtained in the calendar event and they are in easy to work with string formats. Here are a few.

'String {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemCustomerName'
'String {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemCustomerEmail'
'String {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemCustomerPhone'
'String {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemCustomerNotes'

You can call multiple extended properties in the expand call like so in the API call like so.

$expand=singleValueExtendedProperties($filter%3Did eq 'Binary {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemAnsweredCustomQuestions' or id eq 'String {ccb88e73-951a-4b10-bb49-e6628b8d8494} Name BookingItemCustomerName')

This page explains expanded properties a bit more.

Hope this helps anyone needing this feature.

@safari137
Copy link

Thanks @Tronald that was extremely helpful.

@fpintos is this method supported? (Pulling the data from the event extensions) We are considering building out this functionality but are concerned about whether or not it will always work this way?

@coupalm
Copy link

coupalm commented Oct 5, 2020

Any idea how to extract customers info when the booking event support multiple customers (when you set maximum attendees higher than 1 in the service). It is not available in the attendees property... Booking Graph API does not expose this information also...

@rfoust
Copy link

rfoust commented Dec 28, 2020

This has been open for 3 years now...is there no way to get customers info, specifically custom fields, when there are more than 1 attendee via Graph?

@khuffman66
Copy link

khuffman66 commented Jan 17, 2021

I was able to extract custom field data successfully using Power Automate, but only for single customer services.

Flow Description

This flow runs nightly and parses user data from events located in a generic Outlook account calendar (this account is being used by the Bookings app to schedule appointments) then creates a CSV file stored in a Shared Documents team library. Attached are the details of my solution.
Bookings event details to CSV file using Power Automate.docx

Hope this helps!
~Kimberly

@zigagiz
Copy link

zigagiz commented Mar 18, 2021

This simple issue has been open for 1259 days and it's still not resolved ...

Can we get the custom fields (questions and answers) when calling Get Appointment, please?

@khuffman66
Copy link

@zigagiz - my solution noted in this previous post works; however, the TSV export in the Bookings app now includes custom fields.

@zigagiz
Copy link

zigagiz commented Mar 19, 2021

@khuffman66 - I've tried Tronald's solution and it's what we'll need for our use case. I just find it baffling that custom fields aren't present in the Get bookingAppointment response, but need to be retrieved via a different API.

@brad302
Copy link

brad302 commented Oct 28, 2022

@Tronald (Justin) ... thanks for the answer, very useful. However, it's been a couple of years since you commented and provided the solution but I have to ask, how the hell did you know that those filters were the ones to use to get the relevant values? I haven't found a scrap of documentation that provides that answer and yet here it is.

Keen to understand so if you can remember then it'd be great to share.

@Tronald
Copy link

Tronald commented Oct 28, 2022

@brad302 I am so happy my answer has been helpful. I don't remember exactly how I figured this out, but it started with reading issue #7 . Once I learned about the extended properties, I believe I basically attempted a bunch of property name guesses based on @fpintos use of 'BookingItemCustomerName' and looked at what was successfully returned.

Thankfully, the property naming conventions were consistent so it wasn't too bad to guess my way to the answer. It would be so much nicer if Microsoft provided easy to find documentation though.

This is just one of those times where determination mixed with a bit of luck to got me to the answer.

@brad302
Copy link

brad302 commented Oct 28, 2022

@Tronald ohhhhhhhh I see, he's listed the possibilities right there in issue #7 ...!

I find it baffling that it's not officially documented somewhere.

Thanks again man, you saved me!

@fpintos
Copy link
Member

fpintos commented Nov 6, 2022

Closing this issue here on the samples.
I suggest using https://developer.microsoft.com/en-us/graph/support to submit questions and feature requests for more visibility. Thanks.

@fpintos fpintos closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests