Graph API error when querying BookingBusinesses - ErrorExceededFindCountLimit, The GetBookingMailboxes request returned too many results


⛔️ PROBLEM

You are trying to get booking businesses using GET request using Graph API but receive ErrorExceededFindCountLimit error.
|Request --> GET https://graph.microsoft.com/beta/bookingBusinesses
Microsoft Graph API error ErrorExceededFindCountLimit
Microsoft Graph API error ErrorExceededFindCountLimit
Error:
{
  "error": {
    "code": "ErrorExceededFindCountLimit",
    "message":
      "The GetBookingMailboxes request returned too many results. Please specify a query to limit the results.",
  }
}

⚡️ ANALYSIS

Service account is setup in Azure AD with App Registration with necessary permissions - Bookings.Read.All, BookingsAppointment.ReadWrite.All, Bookings.ReadWrite.All, Bookings.Manage.All. But you receive error when executing the code.

As the error states "returned too many results", the return values look to be beyond the set threshold. Getting the list of bookingBusinesses may also fail when an organization has several Bookings businesses and the account making the request is not an administrator.

⛏️ Fix ErrorExceededFindCountLimit error when querying bookingBusinesses using Microsoft Graph ?

Limit the request to return the set of businesses by including a query parameter. This will limit the result set and return the businesses that have given search text in their name or e-mail address.
GET https://graph.microsoft.com/beta/bookingBusinesses?query=Code2Care

Using this approach, you can now pass the name or email id of the business that you want to query and fetch limited results.





Recent Posts:
Hello there!,

You are using AdBlocker!

I am an independent developer trying to help fellow developers and students to resolve issues faced on a day-to-day basis, we 'Code to Care' . There is a lot of expenses involved in hosting and managing a website that's the reason we have ads.

A humble request to you to disable adBlocker on Code2care.org and support us pay our bills.

Thanks,
Cod2ecare - Line's of code for change.

To see contents reload page after unblocking
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.