how to find site id and drive id for graph API

Anjali Shevadkar 1 Reputation point

how to find site id and drive id for graph API

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

1 answer

Sort by: Most helpful
  1. ShivaniRai-MSFT 2,726 Reputation points

    Hi @Anjali Shevadkar ,

    According to this document, use the below Graph API Endpoint to fetch the Id of a SharePoint site by passing site name{query}

    Example Reference: Here 'test' is the site name for which we want the site-Id. Grant permission to call this API (please refer below example screenshot from Graph Explorer)

    To fetch drive Id, these are the Endpoints you can use:

    GET /groups/{groupId}/drives (To fetch the drives within a group)  
    GET /sites/{siteId}/drives (To fetch drives for a particular site)  
    GET /users/{userId}/drives (To fetch user's drives)  
    GET /me/drives (To list the current user's drive)  

    Example reference: To fetch drive Id of a particular site. Grant Files.Read permission for this API(please refer below screenshot from Graph Explorer)

    Reference Docs:

    Hope this helps.

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

    2 people found this answer helpful.
    0 comments No comments