Adding folder inside StyleLibrary for User Site Gives Access Denied Error.

Test User 1 Reputation point
2022-08-29T12:20:04.287+00:00

I'm trying to add folder inside the StyleLibrary for a User site. It gives me Access Denied error. Attached SS below.

235772-ui-screenshot.png

Also, When i'm trying to access the folder using CSOM API it is giving me Acess Denied Exception

"exceptionMsg": Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I'm accessing User site as the Admin user, then still why I'm facing this issue ? @Tong Zhang_MSFT @RaytheonXie_MSFT

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,737 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,686 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-08-30T02:26:11.517+00:00

    Hi @Test User ,

    According to my research and testing ,please try to disable parameter setting "DenyAddAndCustomizePages". Here is the PowerShell script:

    Connect-SPOService -Url https://xxxxx-admin.sharepoint.com  
    Set-SPOSite https://xxxxx.sharepoint.com/sites/xxxxx -DenyAddAndCustomizePages 0  
    

    Please add folder as Site Owner to the Style Library . It will not work if you just have "Member" permissions to the site.


    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.



  2. Test User 1 Reputation point
    2022-09-07T07:23:12.463+00:00

    When i try to run this script for user site, it gives me below error

    238462-image.png