0

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?

uday
  • 569
  • 1
  • 6
  • 16

1 Answers1

1

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'
Danstan
  • 1,501
  • 1
  • 13
  • 20
  • How to generate this 'Authorization: Bearer ey...'? – uday Jul 07 '21 at 17:11
  • This depends on how you want to access graph and how you will authenticate. For the start, I recommend testing this using Graph Explorer which generates access tokens for you. Once ready, you can check [Getting started with MS Graph](https://developer.microsoft.com/en-us/graph/quick-start) which guides on how to access graph. – Danstan Jul 07 '21 at 20:37