cannot access specific team site using share-point rest apis

Copper Contributor


I want to create a folder in my custom team site in share-point using REST APIs.


prior steps I have done before that:

I have register the my app in share-point using following URL. https://***


In my App "permission request XML" , I have provide below content. 



<AppPermissionRequests AllowAppOnlyPolicy="true">
  <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl"/>




for get Access Token for accessing those REST APIs I have also created a app in "App Registration" under Azure portal.

when creating those I have provided following API permission for this app.



After doing so I was able to get the bearer access token.


Then I was able to create a folder, attache a file to a new app in share-point using rest apis.

but All those were happened in the "Communication site".


My requirement is to create a folder inside a custom site (team site).

for that I have created a custom site using web interface.

Name called: TeamSite_ForB

following is the REST endpoint url I'm trying to access:



I'm using postman in this case.

so, in the authorization I have set the bearer token.

in the request header section I set the followings.



in the request body I have set the following json body.



	"ServerRelativeUrl":"/sites/TeamSite_ForB/Shared Documents/testFolder"




but when I send the request I'm getting following error response with "403 forbidden"




    "error": {
        "code": "-2147024891, System.UnauthorizedAccessException",
        "message": {
            "lang": "en-US",
            "value": "Access denied. You do not have permission to perform this action or access this resource."





If I put url endpoint as below and request body as below I'm getting 201 response code and folder created inside "communication site".




request body



	"ServerRelativeUrl":"/Shared Documents/testFolder"




so, I just don't want to create folder inside communication site, rather want to create inside custom team site. 


I googled many articles and go through the share-point documentation and I couldn't find any solution for this error.

please can anyone give me insight what I'm doing wrong here.

Any help would be highly appreciated.




0 Replies