BODYBOND
BODYBOND

Reputation: 127

Upload file to SharePoint through rest API Postman

Using Postman

Url:https://test.sharepoint.com/sites/testIntranet/_api/web/GetFolderByServerRelativeurl('testIntranet/BMT')/Files/add(url='114934-image.png',overwrite=true)

error: Access denied

when using this url without /web : https://test.sharepoint.com/sites/testIntranet/_api/GetFolderByServerRelativeurl('testIntranet/BMT')/Files/add(url='114934-image.png',overwrite=true)

error:Cannot find resource for the request GetFolderByServerRelativeurl

Note: Access token is correct with full permissions.

Can anyone please let me know what is correct and what is wrong!

if the first URL is correct then how to get access permissions ? if the second URL is correct then how to add resources correctly ?

Upvotes: 1

Views: 6575

Answers (1)

RaytheonXie-MSFT
RaytheonXie-MSFT

Reputation: 1

The url should be like following

_api/Web/GetFolderByServerRelativeUrl('/sites/abc/FolderTest/Test')/Files/add(url='filename.png',overwrite=true)')

You can upload file in body like following pic enter image description here

Upvotes: 4

Related Questions