Microsoft Graph Sharepoint: unable to get the folder list I expect. The breadcrumb also does not return correct folders in gui.

Larry Bellou 60 Reputation points
2025-02-10T16:07:03.6166667+00:00

Trying to use Microsoft Graph Explorer to be able to get the ids needed for folder Purchasing Shared and id for Purchasing Shared/POs

User's image

But when i run graph explorer for Purchasing Dept I get back different folders (Purchasing Shared is not one of them. The folders in graph explorer OR for the bread crumb above (Document > Purchasing Dept returns following folders
User's image

What am I doing wrong. Graph explorer like..

https://graph.microsoft.com/v1.0/sites/{mysiteid}/drives/{mydriveid}/items/{purchasing dept-itemid}/children

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,040 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.
3,287 questions
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 28,956 Reputation points Microsoft Vendor
    2025-02-12T02:48:11.85+00:00

    Hi @Larry Bellou

    I'm glad to have your feedback. It may sound strange, but I'm really happy for you to hear that the problem has been solved.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.". and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    [Microsoft Graph Sharepoint: unable to get the folder list I expect. The breadcrumb also does not return correct folders in gui.]

    Issue Symptom:

    Trying to use Microsoft Graph Explorer to be able to get the ids needed for folder Purchasing Shared and id for Purchasing Shared/POs

    User's image

    But when i run graph explorer for Purchasing Dept I get back different folders (Purchasing Shared is not one of them. The folders in graph explorer OR for the bread crumb above (Document > Purchasing Dept returns following folders User's image

    What am I doing wrong. Graph explorer like..

    https://graph.microsoft.com/v1.0/sites/{mysiteid}/drives/{mydriveid}/items/{purchasing dept-itemid}/children

    Current status:

    I found a solution finally,

    https://graph.microsoft.com/v1.0/sites/{siteid}/drives/{driveid}/root/search(q='Purchasing Shared')
    

    This showed the PO folder in the results which is the id I needed. Still not sure why the folder Purchasing Shared does not show up and if you click "Breadcrumb" on first screen shot it takes you to second screen shot without Purchasing Shared again. Seems there is a weird set up issue of folders in SharePoint.

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community members to see the useful information when reading this thread. Thanks for your understanding!

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 28,956 Reputation points Microsoft Vendor
    2025-02-11T07:20:46.06+00:00

    Hi @Larry Bellou

    Based on the information you provided, let me clarify my understanding briefly. You want to use graph to get the IDs of two folders in SharePoint, but the result of your attempt is different from what you expected, right? Since you did not provide the specific interface of graph, I cannot determine which step has a problem, so I will write all my steps below for your reference.

    Get Site ID:

    https://graph.microsoft.com/v1.0/sites/domain.sharepoint.com:/sites/sitename?$select=ID
    

    02111

    Get Drive id:

    https://graph.microsoft.com/v1.0/sites/{siteID}/drives?$select=id,name
    

    02112

    Get Folder "Purchasing Dept" id:

    https://graph.microsoft.com/v1.0/sites/{siteID}/drives/{driveID}/items/root/children?$select=ID,name
    

    02113

    Get Folder "Purchasing Shared" id:

    https://graph.microsoft.com/v1.0/sites/{siteID}/drives/{driveID}/items/{itemID}/children?$select=id,name
    

    Replace itemID in the command with the ID of the Purchasing Dept folder.

    02114

    Get Folder "POs" id:

    https://graph.microsoft.com/v1.0/sites/{siteID}/drives/{driveID}/items/{itemID}/children?$select=id,name
    

    Replace itemID in the command with the ID of the Purchasing Shared folder.

    02115

    Note: Since children can only expand the first level of subitems, you need to run it again to get the ID of the POs folder here.

    If there is any misunderstanding, please feel free to contact me.

    Kindly consider accepting the answer if the information provided is helpful. This can assist other community members in resolving similar issues.


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.