I'm trying to use some graph endpoints in a Flow to access a file in a library that isn't the default Documents library. I need to get the graph id for a file. All I'm starting with are the obvious things about the file, site, library name, filename, path to file, etc.

In order to get the file id I found I need to send a request to {sharepoint-site}/_api/v2.0/drives/{drive-id}/root:/{filename}. I have the filename, but I don't have the drive id.

All the tutorial and documentation I'm finding say something along the lines of ".../drive accesses the site's Documents library, if you want to access a different library you will need to use /drives/{drive-id}..." or "...once you have the drive id, then you use this endpoint..."

I can do something like {site}_api/v2.0/drives?$select=id,name which will return all the document libraries in the site and then iterate through those looking for the name or path of the library. But that seems like a lot of extra work.

I tried to append a &$filter=name eq '{library-name]' but that didn't make a difference it just listed all the libraries.

Is there really no way just to get just the drive id for one library? How do I get the drive id based on the path/name of a library?

1 Answer 1


Only the $select query parameter is supported for /drives endpoint, $filter is not supported and would be ignored. as documented here: https://docs.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-beta&tabs=http#optional-query-parameters

You could vote the requests here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.