SOLVED

Discover Office 365 OneDrive for Business URL with “app-only” token

%3CLINGO-SUB%20id%3D%22lingo-sub-62886%22%20slang%3D%22en-US%22%3EDiscover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%E2%80%9Capp-only%E2%80%9D%20token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-62886%22%20slang%3D%22en-US%22%3E%3CP%3EI%20found%20that%20it%20is%20possible%20to%20get%20URL%20from%20user%20One%20Drive%26nbsp%3B%3C%2FP%3E%3CPRE%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F%7Buser_id%7D%2Fdrive%2Froot%3Fselect%3DwebUrl%3C%2FPRE%3E%3CP%3EIs%20it%20possible%20to%20discover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%22app-only%22%20token%20using%20single%20API%20endpoint%20from%20Graph%20API%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-62886%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-63271%22%20slang%3D%22en-US%22%3ERe%3A%20Discover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%E2%80%9Capp-only%E2%80%9D%20token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-63271%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20a%20lot%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-63260%22%20slang%3D%22en-US%22%3ERe%3A%20Discover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%E2%80%9Capp-only%E2%80%9D%20token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-63260%22%20slang%3D%22en-US%22%3EHa!%20I%20need%20to%20improve%20my%20copy%2Fpaste%20skills.%20%3A)%3C%2Fimg%3E%20Updates%20are%20made.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-63199%22%20slang%3D%22en-US%22%3ERe%3A%20Discover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%E2%80%9Capp-only%E2%80%9D%20token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-63199%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F113%22%20target%3D%22_blank%22%3E%40Paul%20Schaeflein%3C%2FA%3E%26nbsp%3Bcan%20you%20correct%20URLs%20in%20%22Details%22%20section%20for%20first%20and%20second%20paragraphs.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-62975%22%20slang%3D%22en-US%22%3ERe%3A%20Discover%20Office%20365%20OneDrive%20for%20Business%20URL%20with%20%E2%80%9Capp-only%E2%80%9D%20token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-62975%22%20slang%3D%22en-US%22%3E%3CP%3ETLDR%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20it%20is%20possible.%20For%20the%20app%2C%20create%20the%20app-only%20scopes%20of%20User.Read%20and%20Files.Read.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDetails%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20User%20resource%20requires%20one%20of%20several%20possible%20permission%20scopes%2C%20documented%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fresources%2Fusers%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fresources%2Fusers%3C%2FA%3E.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20drive%20attribute%20(actually%2C%20the%20get-drive%20method)%20requires%20one%20of%20several%20possible%20permission%20scopes%2C%20documented%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fdrive_get%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fdrive_get%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20list%20of%20available%20scopes%20for%20App-Only%20requests%20(which%20require%20Admin%20Consent)%20are%20docuumented%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fauthorization%2Fpermission_scopes%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fauthorization%2Fpermission_scopes%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I found that it is possible to get URL from user One Drive 

https://graph.microsoft.com/v1.0/users/{user_id}/drive/root?select=webUrl

Is it possible to discover Office 365 OneDrive for Business URL with "app-only" token using single API endpoint from Graph API? 

4 Replies
Highlighted
Best Response confirmed by Yevhen Kryvun (New Contributor)
Solution

TLDR;

 

Yes, it is possible. For the app, create the app-only scopes of User.Read and Files.Read.

 

Details:

 

The User resource requires one of several possible permission scopes, documented at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/users

 

The drive attribute (actually, the get-drive method) requires one of several possible permission scopes, documented at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/drive_get.

 

The list of available scopes for App-Only requests (which require Admin Consent) are docuumented at https://developer.microsoft.com/en-us/graph/docs/authorization/permission_scopes.

 

 

 

 

@Paul Schaeflein can you correct URLs in "Details" section for first and second paragraphs.

Highlighted
Ha! I need to improve my copy/paste skills. :) Updates are made.
Highlighted