How to fetch folder content under a list?

ajay kumar 0 Reputation points
2025-02-13T09:11:10.98+00:00

We are using the sharepoint API but its not working and having issues with pagination. We did the analysis and found that with sharepoint skip does not works and we need to use the graph API but we were unable to find the corresponding API. Please help us to get the graph API to get the result as same with the below sharepoint api.

https://XXXX.sharepoint.com/sites/<SITE_NAME>/_api/web/Lists(guid'<LIST_ID>')/GetItems(query=@v1)?$select=Folder/Name,File/Name,HasUniqueRoleAssignments,FileSystemObjectType,FirstUniqueAncestorSecurableObject/id,File/length,File/ServerRelativeUrl,Folder/UniqueId,File/UniqueId,Folder/ServerRelativeUrl&$expand=FirstUniqueAncestorSecurableObject,File,Folder&@v1={"FolderServerRelativeUrl":"/sites/<SITE_NAME>/Shared Documents/logs_cont (1)/logs_cont","ViewXml":"<View Scope='RecursiveAll'><RowLimit>100</RowLimit></View>"}}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,050 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,209 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 38,956 Reputation points Microsoft Vendor
    2025-02-14T02:26:22.66+00:00

    Hi @ajay kumar,

    As specified in the documentation: https://learn.microsoft.com/en-us/graph/api/driveitem-list-children, if you already have the drive-id than you can just make the following request to list the children:

    GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/root/children
    

    Or if you want to list the items in a sub-folder:

    GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/children
    

    To list the children based on the Path:

    GET https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/{path-relative-to-root}:/children
    

    Such as

    GET https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/Shared Documents/Folder1/File1:/children
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    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.