List files on too deeper folder get error when using Graph API

Huiyan Zhao (Chinasoft) 21 Reputation points
2022-02-15T11:01:40.34+00:00

In our test, if we fill a too deep folder path like below, it will throw an exception.

We try itemPath = "Deep50/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/1/"
var list = await graphServiceClient.Drives[driverId].Root.ItemWithPath(itemPath).Children.Request().GetAsync().ConfigureAwait(false); --> can pass.

string itemPath = "Deep50/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/1/2";
var list = await graphServiceClient.Drives[driverId].Root.ItemWithPath(itemPath).Children.Request().GetAsync().ConfigureAwait(false); -->get fails.

Error Message:
404 - File or directory not found.

Now we see the limitation is 28, try 29 will get fail.
Could anyone know is there a limitation for the path deep? Is possible we can resolve it?

Thanks,
Huiyan

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,716 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,686 questions
0 comments No comments
{count} votes

Accepted answer
  1. Zehui Yao_MSFT 5,831 Reputation points
    2022-02-16T02:46:46.993+00:00

    Hi @Huiyan Zhao (Chinasoft) ,

    Per my test, I could reproduce this issue on my end. And when I add sites/{siteID} in the endpoint, like https://graph.microsoft.com/v1.0/sites/{siteID}/ drives/{drive ID}/root:{folder path}:/children. The result is different, I could only get content in the 25th subfoler.

    Conclusion: Graph has number restriction for slash character(/) in the endpoint. And per my test the max number is about 30. Currently this may be a restriction, you can open a support ticket to resolve this issue.


    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 additional answers

Sort by: Most helpful