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.


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap