Main Problem
I am using Microsoft Graph to access SharePoint resources and I'm having trouble understanding why my syntax isn't working when I try to access a specific file.
My SharePoint is structured like this:
[domain]
- site
- subsite
- library
- file1.pdf
I am able to access a file using the following: (this works)
sites/{SITE_HOSTNAME},{SITE_ID},{SUBSITE_ID}/drives/{DRIVE_ID}/root:/{FILENAME}:/content
However, I would like to access the file using only site, library, and file names (or paths), instead of using ids. Ideally something like this would work: (this does not work)
sites/{SITE_HOSTNAME}:/sites/{SITE_NAME}/{SUBSITE_NAME}/{LIBRARY_NAME}/{FILENAME}:/content
Is anything like this possible?
More details...
I seem to be running into at least two problems:
1. I am unable to access the library as a drive in the same way using site paths as using site ids. E.g.:
# these work as expected
sites/{SITE_HOSTNAME},{SITE_ID},{SUBSITE_ID}/drives/{DRIVE_ID}
sites/{SITE_HOSTNAME}:/sites/{SITE_NAME}/{SUBSITE_NAME}:/drives
# this does not work
sites/{SITE_HOSTNAME}:/sites/{SITE_NAME}/{SUBSITE_NAME}:/drives/{DRIVE_ID}
Why am I unable to access a specific DRIVE_ID in this way?
2. As a workaround, I can access the library as a list instead of a drive ...but then I am unable to get the contents of the list items. For example:
# this works
sites/{S_HOSTNAME}:/sites/{S_NAME}/{SS_NAME}:/lists/{LIB_NAME}/items/{ITEM_ID}
# this does not work (`/content` is not available)
sites/{S_HOSTNAME}:/sites/{S_NAME}/{SS_NAME}:/lists/{LIB_NAME}/items/{ITEM_ID}/content
Is there a way to get content from a list item, the way it can be retrieved from a drive item?
Maybe I'm missing something about how path-based and id-based endpoints are supposed to work together? None of the examples in the documentation are much help.