karel
karel

Reputation: 488

Microsoft Graph API FindRooms ErrorAccessDenied

We are trying to fetch a list of rooms in the organization via user_findrooms on the beta API.

I am using the php-connect-sample and was directed here after creating an issue there.

Our application is registered, and has the required permissions. The user is logged in and redirected correctly. I can successfully get the /me endpoint

When I try to get the /me/findRooms endpoint like this:

$graph = new Graph();
$graph->setApiVersion('beta');
$graph->setAccessToken($_SESSION['access_token']);

$rooms = $graph->createRequest("get", "/me/findRooms")
                        ->setReturnType(Model\EmailAddress::class)
                        ->execute();

Then I get the following error:

Client error: GET https://graph.microsoft.com/beta/me/findRooms resulted in a 403 Forbidden response: { "error": { "code": "ErrorAccessDenied", "message": "Access is denied. Check credentials and try again.", (truncated...)

So it seems to be a permissions error.

We have the following Graph permissions for our app:

Delegated Permissions: User.ReadBasic.All and User.Read.All

Application Permissions: Calendars.ReadWrite and User.Read.All

Which additional permissions are required to access /me/findRooms?

Upvotes: 2

Views: 4975

Answers (1)

Dmitry Pimenov
Dmitry Pimenov

Reputation: 739

In your auth flow, you will need to specify User.Read.All instead of User.Read in your scopes since this API requires reading all users in your directory to find conference room availabilities. Here is more information about how to request such scopes during the /authorize and /token requests.

Upvotes: 1

Related Questions