How to Fix Access is denied while creating folder using REST API in Site sharepoint online?

Thilothama Tenneti 0 Reputation points
2023-01-18T12:36:26.0366667+00:00

Hello,

I'm trying to create a folder in the SharePoint site using REST API

Reproducing steps:

  1. Created access token by using steps mentioned in the below link [https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/
  2. sharepoint I tried creating a folder using the API mentioned in Image.
  3. Initially, I got an invalid token type, an Unauthorized error.
  4. Then followed the steps given in the below link [https://learn.microsoft.com/en-us/answers/questions/714147/token-type-is-not-allowed-error-on-sharepoint-rest
  5. configured these permissions using PowerShell commands set-spotenant -DisableCustomAppAuthentication $false
  6. Then I tried to create a new access token and replaced it in the folder creation API
  7. When I try to execute Untitled Please help to solve this issue
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,066 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,716 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 35,711 Reputation points Microsoft Vendor
    2023-01-19T03:07:25.46+00:00

    Hi @Thilothama Tenneti

    Per my test, I found there is one step missing something in the link you shared. Please check if you have entered App's Permission Request XML and trust it correctly in https://xxx.sharepoint.com/sites/xxx/_layouts/15/appinv.aspx. It should be like following

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

    Then trust it after click create

    User's image

    Finally I created the folder successfully by the steps in the link

    User's image


    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.