Currently, I'm developing a Blazor Web App that reads files from another tenant's OneDrive. We need to have a search functionality through the files using the search for files capability.
I'm using MS Graph SDK.
The code boils down to a simple one-liner:
However, it didn't work and throwed a 401 error:
Status Code: Forbidden
Microsoft.Graph.ServiceException: Code: accessDenied
Message: The caller does not have permission to perform the action.
I already registered my App and added the
Files.Read.All permission but it just didn't work.
Now I remembered, that OneDrive for Business uses Sharepoint as backend and it organizes files within sites.
So they key is to also add the