msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Documentation issues - missing TenantID and Mail.Read scope

Open ATJSM opened this issue 7 years ago • 1 comments

Hi, I was testing the steps mentioned here. I was getting several errors and was able to fix them. Reporting them here in case documentation needs to be updated.

Issue 1: Connect-Graph -ClientId 'ID' -Scopes 'user.read, Calendars.Read, Files.Read'. Based on my tests, I think the TenantID is also needed otherwise, I receive an error.

image

With TenantID, it succeeded.

Issue 2: Get-MeMessage -Top 10 -Skip 10 -Select 'Id, Subject, CreatedDateTime' | Format-Table CreatedDateTime, Subject, Id. This example returns your messages, but for this to work, we need to add 'Mail.Read' to the scopes in the previous step. Otherwise, you will get an 'Access Denied' error.

image

So, to sum up, I needed to run this: Connect-Graph -ClientId 'ID' -Scopes 'user.read, Calendars.Read, Files.Read, Mail.Read' -TenantID 'tenantID' instead of Connect-Graph -ClientId 'ID' -Scopes 'user.read, Calendars.Read, Files.Read'

ATJSM avatar Sep 04 '19 20:09 ATJSM

Issue1: When you register your app, select the option that allows it to work on any tenant and then it will use the /common endpoint and you don't have to specify the tenant. I realize that sounds backward, but that's the way it works.

Issue 2: Sorry for the confusion, yes, you are correct. You need Mail.Read to access messages.

darrelmiller avatar Sep 24 '19 14:09 darrelmiller