uday
uday

Reputation: 779

How to upload files to shared drive using graph explorer

With this graph explorer query, able to list all shared folders.

But, how to access a particular folder inside this and upload files to it?

This link is used for uploading files to normal folders, how to do the same with shared folders?

Upvotes: 0

Views: 795

Answers (1)

Danstan
Danstan

Reputation: 1781

Quoting the docs

DriveItems returned from the sharedWithMe action will always include the remoteItem facet which indicates they are items from a different drive. To access the shared DriveItem resource, you will need to make a request using the information provided in remoteItem in the following format:

So to access or upload to the shared folder, you need the remoteitem.parentReference.driveId and remoteItem.id then navigate the file tree normally for example just use the upload file docs.

To access the folder GET https://graph.microsoft.com/v1.0/drives/remoteitem.parentReference.driveId/items/remoteItem.id

Here is a curl to upload files to a shared folder

curl --location --request PUT 'https://graph.microsoft.com/v1.0/drives/remoteitem.parentReference.driveId/items/remoteItem.id:/File.txt:/content' \
--header 'Authorization: Bearer ey...' \
--header 'Content-Type: text/plain' \
--data-raw 'Hello'

Upvotes: 1

Related Questions