Graph API [Sharepoint Subpath] Issue with output #13430

Jatish Khanna 1 Reputation point
2021-08-06T10:32:32.48+00:00

Graph API URls:

https://graph.microsoft.com/v1.0/sites/:/sites/:/drive

https://graph.microsoft.com/v1.0/sites//drive

Output:

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
"createdDateTime": "2021-07-xxTxx:xx:xxZ",
"description": "",
"id": "",
"lastModifiedDateTime": "2021-07-xxTxx:xx:xxZ",
"name": "Documents",
"webUrl": "https:///sites//Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"displayName": "System Account"
}
},
"owner": {
"user": {
"email": "",
"id": "< id >",
"displayName": "Jatish Khanna"
}
},
"quota": {
...
}
}

--- It works but building a subpath on the above URL have different outputs ----

Example Subpaths:
https://graph.microsoft.com/v1.0/sites/:/sites/:/drive/root
https://graph.microsoft.com/v1.0/sites//drive/root

Adding root to these subpaths doesn't work. This seems issue with the Graph API implementation.

Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ID: 6079ba35-dd9e-fe22-5254-2b7e0b5ab650
Version Independent ID: 18340dad-3014-1888-7bf7-3da9af9973e7
Content: Get a file or folder - Microsoft Graph v1.0
Content Source: api-reference/v1.0/api/driveitem-get.md
Product: sharepoint
Technology: microsoft-graph
GitHub Login: @JeremyKelley
Microsoft Alias: MSGraphDocsVteam
Github Issue: Details

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,592 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-08-09T06:49:42.857+00:00

    Hi @Jatish Khanna ,

    Per my test, I got the same result as yours on my end: 400 BadRequest in the response for /sites/{hostname}:/{server-relative-path}:/drive/root.

    Looks like Graph API do not add support for the particular endpoint drive/root when using server-relative URL. Currently, we have to use site-id in the request.

    You could submit the feature request here: https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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