Sharepoint - Which special Characters are not Allowed in SharePoint 2013\2016 Files\Folders?

You cannot use the following characters in file/folder name:

Tilde (~)
Number sign (#)
Percent (%)
Ampersand (&)
Asterisk (*)
Braces ({ })
Backslash (\\)
Colon (:)
Angle brackets (< >)
Question mark (?)
Slash (/)
Plus sign (+)
Pipe (|)
Quotation mark (")

There are also restrictions about the positition of a character in a file/foldername:

  • You cannot use the period character consecutively in the middle of a file/folder name.
  • You cannot use the period character at the end of a file/foldername.
  • You cannot start a file/foldername with a period character.
  • If you use an underscore character (_) at the beginning of a file/foldername, the file/folder will be a hidden file/folder.

In addition, file names and folder names may not end with any of strings:

.files
_files
-Dateien
_fichiers
_bestanden
_file
_archivos
-filer
_tiedostot
_pliki
_soubory
_elemei
_ficheiros
_arquivos
_dosyalar
_datoteke
_fitxers
_failid
_fails
_bylos
_fajlovi
_fitxategiak

Source: http://support.microsoft.com/kb/905231/en-us


~, #, %, & , *, {, }, \, :, <, >, ?, /, |, "

above special character is not allowed for files/folder.. you need to replace these characters for create folder or files..


Not to resurrect an old thread but I thought I would add my regex. One issue from KB905231 it is not clear if the prohibited file suffixes (i.e. .files or _files, etc.) are including or excluding the file extension. I assumed including so foo.doc.files would not match but foo.files.doc would.

^(?![\._]|.*(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$)[^!#%&*{}\:<>?\/|"]+$

Edit (1/26/17): It did not prevent tilde or double period in the middle. Here is a new one with some unit tests at https://regex101.com/r/XWYV2r/2

This is only lightly tested. YMMV.

(?!.+\.\..+)^(?![\._]|.*(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$)[^~#%&*{}\\:<>?\/|"]+$