question

jbish55-2914 avatar image
0 Votes"
jbish55-2914 asked SharepointAdmin-7852 edited

Graph CreateLink not returning correct url and permissions

I have my Graph API setup to 1) Get a token; 2) Upload a file; 3) Get a shareable link for that uploaded file.

I have no problem getting the token and uploading the file. However, I can't seem to get a shareable link. While I set the scope to anonymous, it always returns "existingAccess". And the webUrl is a personal url with the path to file listed therein. There is no authKey or token in the url as I've seen in other examples online.

Am I doing something wrong? How can I get a link that I could share with anyone regardless of their being logged in or associated with my organization? Any help would be appreciated!

microsoft-graph-files
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Which url are you calling?

0 Votes 0 ·

I'm calling "https://graph.microsoft.com/v1.0/users/{$user_id}/drive/items/{$item_id}/createLink". It does return, just not with a shareable link. It won't allow me to change the scope to anonymous for some reason. I did also test this in the Graph Explorer and successfully received a shareable link there. But it's not working in production. Thank you!

0 Votes 0 ·

Hi, While using the same API, i m getting error with message "The request entity's media type 'text/plain' is not supported for this resource." can you help me with this? Thank you.

API - https://graph.microsoft.com/v1.0/me/drive/items/{item-id}/createLink
Req Body -
{
type: 'view',
scope: 'anonymous'
}
Req Header - Bearer Token



0 Votes 0 ·

1 Answer

jbish55-2914 avatar image
0 Votes"
jbish55-2914 answered CarlZhao-MSFT edited

Update: Once I added the API Permissions for "Sites.Manage.All" it worked as expected. The documentation does not list this as a required permission and may need updated. Unless I'm doing something wrong that I'm unaware of.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Correction: "Sites.FullControl.All" is the permission needed.

0 Votes 0 ·

Hi, you can accept your answer to end the thread :)

0 Votes 0 ·