Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Apr 26 '12 at 15:34

This question came from our site for professional and enthusiast programmers.

    
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 Apr 9 at 14:19
add comment

5 Answers 5

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[] { '\\', '/', ':', '*', '?', '"', '<', '>', '|', '#', '{', '}', '%', '~', '&' };
share|improve this answer
    
thank you!!!!! ! –  aspguy Jun 24 '09 at 23:31
    
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 Oct 22 '09 at 22:02
add comment

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

share|improve this answer
    
+1 for a simple, yet complete answer. –  Omegacron Apr 9 at 14:20
add comment

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

share|improve this answer
add comment

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

share|improve this answer
    
thanks! i'm using forms based authentication! will it work. so far, fba has not been easy! –  aspguy Jun 24 '09 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 Jun 24 '09 at 19:40
    
had to switch to windows! empty folders work but not folders with &! thanks! –  aspguy Jun 24 '09 at 19:46
    
you can't get around the "&" issue, but you can at least retain your particular directory structure –  curtisk Jun 24 '09 at 20:01
add comment

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);
}
share|improve this answer
add comment

Your Answer

 
discard

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