Sample request body for createLink api scope USER

Lim Zi Lin 0 Reputation points
2025-01-27T01:40:08.2666667+00:00

I've reviewed the documentation for the createLink API and noticed that it has a USER scope. However, I couldn't find any information about the request body. Can anyone provide an example of the request body?

I have tried using this API with the example request body from chatgpt and it return me 400 Bad Request.

User's image

Here is the link

https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,241 Reputation points Microsoft External Staff
    2025-01-27T07:18:12.8866667+00:00

    Hi @Lim Zi Lin ,

    Thank you for posting in this community.

    I think you have a bit of a misunderstanding about this API, which I will clarify in more detail below.

    User's imageYour request body uses three properties, types, scope, and recipients, where the only properties supported by the createLink API are types and scope, and recipients are not supported. Users values are allowed for the scope properties. In other words, the createLink API does not support specifying users.

    Here's a screenshot of my test:

    User's image


    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.