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

1 Answer 1


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).


Your Answer

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

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