access one drive with azure graph api

Prasad, Rakesh 221 Reputation points
2022-07-21T15:49:50.687+00:00

hi,

i have registered an app and enabled files.read.

app ID works, atleast from authentication perspective. I have tested it.

this app (client-id and secret) i will be sharing with 3rd party (outside my ORG) so their code can come in and access files from OneDrive.

my companies oneDrive is a source.

now my question is, how to share file with 3rd party. Ideally i was thinking of adding "app-id/client-id/object-id" in OneDrive interface, but it is not possible. I cannot search that.
Also first option is disabled in my company. So I cannot create globally sharable link (see screenshot).

so i am not sure what 3rd party will write in their code to access files (predefine) from my OneDrive (business account) via code (python or postman).

223272-image.png

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Diya Ahuja 5 Reputation points
    2023-06-30T18:07:00.67+00:00

    To share files with a third party using an app ID, you can use the Microsoft Graph API. The API allows you to create a sharing link that can be used to access the file. To create a sharing link, you need to make a POST request to the /shares endpoint with the driveItem resource. You will also need to provide the scope parameter with the value files.read to grant the third party read access to the file. Once the request is successful, you will receive a response containing the sharing link that can be used to access the file.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.