Hi @Mocoloco,
Thank you for posting in this community.
The following example shows how to create a folder by using Rest API.
POST https://{site_url}/_api/web/folders
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Content-Type: "application/json"
Content-Length: {length of request body as integer}
X-RequestDigest: "{form_digest_value}"
{
"__metadata": {
"type": "SP.Folder"
},
"ServerRelativeUrl": "/document library relative url/folder name"
}
If you continue to encounter System.UnauthorizedAccess Exception, I recommend that you first parse your access token into this widget and check that the permissions recorded in your SCP section match the permissions you should be granted. Also, make sure you're using the access token of the Rest API and not the access token of the Graph API.
Sometimes people confuse these two which leads to UnauthorizedAccess Exception.
Here is a method to obtain the access token of the REST API: Access SharePoint Online data using postman tool.
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.