question

LouisCuypers-0516 avatar image
0 Votes"
LouisCuypers-0516 asked saldana-msft edited

Get site Id SharePoint

I'm doing a GET request to: https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{path}?$select=id
where {hostname} = harmony***.sharepoint.com and {path} = GraphApi
200585-image.png
Header: authorization = Bearer ... (Roles in this bearer are Sites.Selected)

I keep getting error 403 Forbidden - access denied.
200605-image.png

Anyone knows how to fix this?

I'm trying to upload a file to sharepoint with the API.

sharepoint-devmicrosoft-graph-identitymicrosoft-graph-applicationsmicrosoft-graph-permissions
image.png (3.7 KiB)
image.png (16.0 KiB)
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.

1 Answer

ShivamDhiman-1582 avatar image
0 Votes"
ShivamDhiman-1582 answered ShivamDhiman-1582 edited

Hi @LouisCuypers-0516

This error occurs when you do not have right permissions. You need these permissions to get the sites.
Reference
200599-permissions2.png

To upload file to sharepoint you need to use this endpoint
PUT /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content with these permissions.
Note: This method only supports files up to 4MB in size.

To upload large files with an upload session, please refer to this document.

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".


permissions2.png (33.6 KiB)
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.