Share Folder via API

Akshith Reddy Thalla 140 Reputation points
2024-07-18T09:18:30.34+00:00

We have done the SharePoint Integration using MSGraph API. Now, We have to share a particular folder to specific user through an API.

Do we have an API to share the particular folder?

User's image

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

Accepted answer
  1. AllenXu-MSFT 20,891 Reputation points Microsoft Vendor
    2024-07-19T06:29:04.7966667+00:00

    Hi @Akshith Reddy Thalla,

    To share a folder, you can use the POST /drives/{drive-id}/items/{item-id}/invite endpoint, where {drive-id} is the ID of the drive where the folder is located, and {item-id} is the ID of the folder you want to share. To get {drive-id} and {item-id}, you can take a reference to this article: How to Find Site Id, Drive Id and Item Id using Microsoft Graph API.

    Reference: Send a sharing invitation.

    For example,

    https://graph.microsoft.com/v1.0/drives/b!fIIel_ckvEGuCEQKxsYKyUPocDuiXE5PpCID5WtvTNY2aGNaWsxbQ5_grpudLNED/items/0144RNNBG2JCXTFGLWHRFYFQ6XRSSVMCXM/invite
    
    
    {
        "recipients": [
            {
                "email": "user@xxx.onmicrosoft.com"
            }
        ],
        "message": "Here's the file that we're collaborating on.",
        "requireSignIn": true,
        "sendInvitation": true,
        "roles": [
            "write"
        ],
        "password": "password123"
    }
    
    
    

    If the answer is helpful, please click "Accept as 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

0 additional answers

Sort by: Most helpful

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.