I have an SP library that allows the users to store files and create folders with the edit permission role.

When the library reaches the 30k number of items, I would like to hide the new & upload button from the ribbon and show a very simple alert for the user “You cannot create or upload any files/folders you have exceeded the limit, please create a new library”.

enter image description here

In that way I obliged the users to create a new library to avoid the limitations of SharePoint.

What will be the solution to achieve the above requirements?

Could you please provide an example?

Any help is highly appreciated.

Thank you.

1 Answer 1


Unfortunately, there are no supported ways to make these changes to the user interface in a modern page.

You could switch the library to use the classic experience and then use JavaScript to manipulate the click events of the New and Upload buttons. The JavaScript can be added to the page using a Content Editor or Script Editor web part. Sorry, but I don't have a code sample handy that shows how to do this.

You can switch to the classic experience by going to Library settings > Advanced settings and updating the List experience setting.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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