0

The image below shows a way to disable Folder creation for the entire Document Library. Is there a way to limit this functionality to specific users / groups?

enter image description here

1

By default, we can't control the permission for this feature.

As a workaround, we can use JavaScript code to achieve it. Check if the current user in the limit user array, and hide the New Folder using CSS style.

The following code for your reference.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$("#RibbonContainer").ready(function (){
    var currentUserId=_spPageContextInfo.userId;
    var limitUserIds=[1,3];  
    if($.inArray(currentUserId, limitUserIds)!=-1){
        $("head").append("<style>a[id='Ribbon.Documents.New.NewFolder-Large']{display:none;}</style>");
    }
})
</script>
| improve this answer | |
  • That's great, but what about the Modern experience? – Michael Colbs May 24 '19 at 3:13
  • For modern experience, you can use an SPFx Application Customizer to add JavaScript (e.g. header) to every page in a site. sharepointnutsandbolts.com/2017/06/… – LZ_MSFT May 24 '19 at 7:40
  • so are you hard coding the user Ids in your code? I'm assuming they wouldn't be single ints. – Michael Colbs May 24 '19 at 15:43
  • You can get all the user's Id from a group using REST API, or check if the current user in the group or not. – LZ_MSFT May 27 '19 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.