7

I'm trying to upload files and folders to a library using SharePoint Designer 2007 (on a WSS 3.0 SharePoint site).

It's giving me an error when I try to upload empty folders or folders that have an & in their name.

OS: Windows Vista, Windows Server 2008.

Can someone please assist?

1
  • I realize this was asked 4 years ago, but it just so happened to bump to the top of the list today... and I just had a user ask me about it not ten minutes ago. Intentional or not, the timing was awesome.
    – Omegacron
    Commented Apr 9, 2014 at 14:19

6 Answers 6

8

There are certain characters that SharePoint does not allow in the filename. Unfortunately the ampersand character is one of them! Here is a list I've found, I'm not sure if there's an official list somewhere:

char[] InvalidFilenameCharacters = new[] { '\\', '/', ':', '*', '?', '"', '<', '>', '|', '#', '{', '}', '%', '~', '&' };
1
  • 1
    In addition to the characters Alex Angas listed, SharePoint also doesn't support files and folders with Unicode 0-31, 127, or 129-159 in their names (mostly unprintable / invisible). Empty folders can be added in SharePoint Designer using the New Folder button, but they're ignored during import operations.
    – Morbo
    Commented Oct 22, 2009 at 22:02
5

Just to pile on to the existing answers, this seems to be the most comprehensive answer [formatted for better readability]:

You cannot use the following characters anywhere in a file name:

  • Tilde
  • Number sign
  • Percent
  • Ampersand
  • Asterisk
  • Braces
  • Backslash
  • Colon
  • Angle brackets
  • Question mark
  • Slash
  • Pipe
  • Quotation mark

You cannot use the period character consecutively in the middle of a file name.

You cannot use the period character at the end of a file name.

You cannot start a file name by using the period character.

If you use an underscore character (_) at the beginning of a file name, the file will be a hidden file.

File names and folder names may not end with any of the following strings:

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

In addition, file names and folder names cannot start with the “vti” string, such as the followings:

  • _vti_cnf
  • _vti_pvt
  • _vti_bin
  • _vti_txt

All of the above is from:

3

Here is a list of restrictions in SharePoint. The characters it lists as not being able to be used in a folder name are ~ # % & * { } \ : < > ? / | "

1
  • 1
    +1 for a simple, yet complete answer.
    – Omegacron
    Commented Apr 9, 2014 at 14:20
3

It's still true in SP2010 unfortunately - even though you can now upload, behind the scenes when you need to use functions such as System.Web.HttpUtility.UrlEncode(item_url) and SPEncode.UrlEncode(item_url), they will then unwantedly encode the forward slash as well as ignore ampersands, so it seems not worth the hassle. Same with SP2013 RTM too.

You can show any client/users it's not your fault currently by confirmation here: http://support.microsoft.com/kb/905231 (covers up to SP2010).

1

for checking, if a file name is valid in SharePoint, you also must prevent consecutive dots in the filename and a dot at the beginning or at the end of a filename.

Please see also here http://support.microsoft.com/kb/905231/en-us (there is also the plus sign "+" and a starting "_" mentioned as forbidden, but that works for SharePoint file names.

These are rquirements "on top" of being a valid Windows file name. To check for a valid windows file name, you can use Path.GetInvalidFileNameChars()

c# code (without the dot checks)

var invalidChars = Path.GetInvalidFileNameChars();
var additionalInvalidSharePointSpecialCharacters = new char[7] { '~', '#', '%', '&', '{', '}', '+' };
invalidChars = invalidChars.Concat(additionalInvalidSharePointSpecialCharacters.AsEnumerable()).ToArray();

var failingDotsRemoved = Regex.Replace(new string(invalidCharsRemoved), @"\\.+", @".");

if (failingDotsRemoved[0].Equals('.'))
{
 failingDotsRemoved = failingDotsRemoved.Substring(1);
}

if (failingDotsRemoved[failingDotsRemoved.Length - 1].Equals('.'))
{
 failingDotsRemoved = failingDotsRemoved.Substring(0, failingDotsRemoved.Length - 1);
}
0

Even easier, go to the site in question, go to the library, change the view to explorer view("View:" dropdown at top right of document view pane).

Then you can drag and drop the folder/subfolder/documents directly into sharepoint...maintains structure and will even allow empty folders

4
  • thanks! i'm using forms based authentication! will it work. so far, fba has not been easy!
    – aspguy
    Commented Jun 24, 2009 at 19:35
  • good question, we don't have any form based, but it will take you second to prove out whether it works, try it!
    – curtisk
    Commented Jun 24, 2009 at 19:40
  • had to switch to windows! empty folders work but not folders with &! thanks!
    – aspguy
    Commented Jun 24, 2009 at 19:46
  • you can't get around the "&" issue, but you can at least retain your particular directory structure
    – curtisk
    Commented Jun 24, 2009 at 20:01

Your Answer

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