SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Sharepoint 2010, is there a way to limit the names that folders and files can be given, and is there a way to set criteria for any document libraries that are created by users? Here is what I'd like to accomplish:

  1. files and folders to act the same as adding wiki pages where spaces are converted to hyphens
  2. set a limit on the length of the names of files and folders
  3. set a newly created document library (created by users) to already have the elements required for enterprise keywords and automatically require that the keyword field be set; and force descriptions to be required on the files uploaded to those libraries
share|improve this question

For #1 and #2, you will want to take a look at the ItemAdding event receiver. This event runs before the item is fully added to SharePoint. From here, you can perform a simple replace on the file name to convert spaces to hyphens, and check the length of the name. If necessary, you can cancel the add (see the example below).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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