Forum Discussion
New-MgBookingBusinessService CustomQuestions
That worked!!!
Part 2 of this... I know how to Get-MgBookingBusinessAppointment but how do I get the customer responses to the Custom Questions?
Hi AP_TC_ECASD
Nice hear that worked! Now for getting the customer responses to the custom questions, probably i'll try to use the Get-MgBookingBusinessAppointment command to fetch the appointment details. Them, after that, the responses to the custom questions will be part of the CustomQuestions property in the appointment object.
Here’s a way to try to get the responses:
$appointmentId = "your-appointment-id" # Replace with the actual appointment ID
$appointment = Get-MgBookingBusinessAppointment -BookingBusinessId $bookingBusinessId -AppointmentId $appointmentId
# Display the custom questions and responses
$appointment.CustomQuestions | ForEach-Object {
Write-Host "Question: $($_.DisplayName), Response: $($_.Answer)" -ForegroundColor Green
}
You only have to replace $appointmentId with the ID of the appointment you're interested in, and this should give you the responses to the custom questions for that appointment. I think this may work. Let me know how it goes!
- AP_TC_ECASDJan 27, 2025Copper Contributor
luchete Hmmmm... it comes back like this:
PS C:\Users\XXXXXX> $bookingBusinessId = "MYBOOKINGSBUSINESSID" $bookingAppointmentId = "AAMkAGYxMDIzZDRkLTAwMGUtNGQwNS05ZTZiLTdjNTE1NjQzYTI3ZABGAAAAAADIMrXgMknYSZZkpJugZS9XBwCa04VGcf1RTZr1hfB7M9VMAAAAAAENAACa04VGcf1RTZr1hfB7M9VMAAAHDGRNAAA=" # Retrieve the appointment details $appointment = Get-MgBookingBusinessAppointment -BookingBusinessId $bookingBusinessId -BookingAppointmentId $bookingAppointmentId # Display the custom questions and responses $appointment.CustomQuestions | ForEach-Object { Write-Host "Question: $($_.DisplayName), Response: $($_.Answer)" -ForegroundColor Green } Question: , Response:
Do you think the responses are in CustomerNotes somehow?TypeName: Microsoft.Graph.PowerShell.Models.MicrosoftGraphBookingAppointment Name MemberType Definition ---- ---------- ---------- Add Method void Add(string key, System.Object value), void IAssociativeArray[Object].Add(string ... Clear Method void Clear(), void IAssociativeArray[Object].Clear() ContainsKey Method bool ContainsKey(string key), bool IAssociativeArray[Object].ContainsKey(string key) CopyFrom Method void CopyFrom(System.Collections.IDictionary source), void CopyFrom(psobject source) Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() Remove Method bool Remove(string key), bool IAssociativeArray[Object].Remove(string key) ToJson Method Microsoft.Graph.PowerShell.Runtime.Json.JsonNode ToJson(Microsoft.Graph.PowerShell.Ru... ToJsonString Method string ToJsonString() ToString Method string ToString() TryGetValue Method bool TryGetValue(string key, [ref] System.Object value), bool IAssociativeArray[Objec... Validate Method System.Threading.Tasks.Task Validate(Microsoft.Graph.PowerShell.Runtime.IEventListene... EntityItem ParameterizedProperty System.Object EntityItem(string index) {get;set;} Item ParameterizedProperty System.Object IAssociativeArray[Object].Item(string index) {get;set;} AdditionalInformation Property string AdditionalInformation {get;set;} AdditionalProperties Property System.Collections.Generic.IDictionary[string,System.Object] AdditionalProperties {get;} AnonymousJoinWebUrl Property string AnonymousJoinWebUrl {get;set;} AppointmentLabel Property string AppointmentLabel {get;set;} CreatedDateTime Property System.Nullable[datetime] CreatedDateTime {get;set;} CustomerEmailAddress Property string CustomerEmailAddress {get;set;} CustomerName Property string CustomerName {get;set;} CustomerNotes Property string CustomerNotes {get;set;} CustomerPhone Property string CustomerPhone {get;set;} Customers Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphBookingCustomerInformationBase[] Cus... CustomerTimeZone Property string CustomerTimeZone {get;set;} Duration Property System.Nullable[timespan] Duration {get;} EndDateTime Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDateTimeZone EndDateTime {get;set;} FilledAttendeesCount Property System.Nullable[int] FilledAttendeesCount {get;} Id Property string Id {get;set;} IsCustomerAllowedToManageBooking Property System.Nullable[bool] IsCustomerAllowedToManageBooking {get;set;} IsLocationOnline Property System.Nullable[bool] IsLocationOnline {get;set;} JoinWebUrl Property string JoinWebUrl {get;set;} LastUpdatedDateTime Property System.Nullable[datetime] LastUpdatedDateTime {get;set;} MaximumAttendeesCount Property System.Nullable[int] MaximumAttendeesCount {get;set;} OptOutOfCustomerEmail Property System.Nullable[bool] OptOutOfCustomerEmail {get;set;} PostBuffer Property System.Nullable[timespan] PostBuffer {get;set;} PreBuffer Property System.Nullable[timespan] PreBuffer {get;set;} Price Property System.Nullable[double] Price {get;set;} PriceType Property System.Nullable[Microsoft.Graph.PowerShell.Support.BookingPriceType] PriceType {get;s... Reminders Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphBookingReminder[] Reminders {get;set;} SelfServiceAppointmentId Property string SelfServiceAppointmentId {get;set;} ServiceId Property string ServiceId {get;set;} ServiceLocation Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphLocation ServiceLocation {get;set;} ServiceName Property string ServiceName {get;set;} ServiceNotes Property string ServiceNotes {get;set;} SmsNotificationsEnabled Property System.Nullable[bool] SmsNotificationsEnabled {get;set;} StaffMemberIds Property string[] StaffMemberIds {get;set;} StartDateTime Property Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDateTimeZone StartDateTime {get;set;}
- lucheteJan 31, 2025Iron Contributor
Hi AP_TC_ECASD,
Did you have the chance to try that? Did it work for you? If so, would you mind closing or marking this thread as solved?
Thanks and regards!
- AP_TC_ECASDJan 31, 2025Copper Contributor
Hi luchete ,
Unfortunately it did not... customQuestions is kind of a separate animal and I can't seem to get anything out of CustomerNotes. If you get time, will you please take this challenge on for me? I know that's a lot to ask. I've been combing their documentation and literally nowhere does it mention those Custome information out of the box questions. Otherwise, I'll close this for you! :)
- lucheteJan 28, 2025Iron Contributor
The custom questions might not be directly showing up under the CustomQuestions property. But, since the CustomerNotes property is populated, it’s possible that the responses are being saved there instead.
Try checking the CustomerNotes for the response like this:
$appointment.CustomerNotes
Let me know what you find there!