Getting 404 when using /sites/{site-id}/drive/items/{item-id}/children

Michael Chen 0 Reputation points
2024-08-12T16:06:41.35+00:00

I'm trying to use /sites/{site-id}/drive/items/{item-id}/children (mentioned here) to retrieve items from a folder in a Sharepoint site. However, I keep on running into a 404. I am getting the site and item ids by doing the following:

  1. https://graph.microsoft.com/v1.0/sites?search=* to retrieve all the sites. I'm then picking the one I want
  2. https://graph.microsoft.com/v1.0/sites/{site_id}/drives using the site_id I get from 1.
  3. https://graph.microsoft.com/v1.0/drives/{site_drive_id}/root/children using the site_drive id from 2 to list all the folders in the root of the correct site drive. I then find the folder I want from this API call.

However, when I use the folder id from 3, in combo with the site id i get from 1, I hit the 404. Any ideas?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,273 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,142 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,827 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,273 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Azizkhon Ishankhonov 435 Reputation points
    2024-08-12T16:45:52.36+00:00

    Hi @Michael Chen

    The relative path that you are trying to use does not exist. Please refer to available resources via Graph Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer enter image description here

    0 comments No comments

Your answer

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