Search code examples
office365microsoft-graph-apionedrive

Graph API - Is OneDrive personal or OneDrive for Business (ODFB)


Our Application makes use of Microsoft Graph API and communicates with OneDrive for Business (ODFB). Our primary use case are tenant administrators in ODFB.

I want to limit authentication to ODFB only. I have admin only permission scopes, but OD personal still happily authenticates.

Was thinking of using my site url endpoint, which works for ODFB but returns 404 for OD personal:

https://graph.microsoft.com/v1.0/me?$select=mySite

Feels contrived though, plus user would be successfully authenticated before we can check whether this is OD for personal (which isn't ideal)

Is there a better way?


Solution

  • In your authentication request URL, replace the /common/ tenant with /organizations/. This will restrict authentication to only AAD accounts (i.e. OneDrive for Business).

    You can find a detailed explanation in this documentation.