Microsoft 365 Scope ‘Find Files And Folders’ giving AccessDenied Message: Either scp or roles claim need to be present in the token

Hello forum, I am using Microsoft 365 Scope with authentication type ‘ApplicationIdAndSecret’. I have registered Microsoft Graph Api on Azure and have granted Files.Read, Files.ReadWrite and
Files.ReadWrite.AppFolder permissions, but while executing I am getting following error. Can someone please help me on this? I am new to using Microsoft Graph Api.

image

Hi @Adham_Garcia1

Check if the file path you are using is correct, if you are building the path for files/folders dynamically use write line to see if path is correct.

Hope this is helpful

@Adham_Garcia1 have you figured it out?

Had this issue and got it sorted by doing the following:
Make sure the App Permissions in azure is from the Application permissions, not the Delegate permissions because we require Unattended access

Application permission set so it works for me:

  • Files.Read.All
  • Files.ReadWrite.All
  • Sites.Manage.All
  • Sites.Read.All
  • Sites.ReadWrite.All

I had the same issue with authentication type “ApplicationIdAndSecret” and solved it like the following:

  1. App Registration without using any Platform-Type or Redirect-URI and selected Single Tenant
  2. Add API- Permission for Application and grant Admin permissions
  3. Allow Public Client flow
  4. Assign Secret Key
clientPW = New System.Net.NetworkCredential("","YourSecretValue").SecurePassword
clientID = "70e3ca32-f7ff-***"

In Microsoft 365 Scope assigned the values like the following

I hope this will help you :slight_smile: