How do I make SharePoint accept attachments with special characters in the filename?

I noticed that every time I try to attach a file to a SharePoint list, if the file name contains any special characters (#, &, @, ...) it will fail. Will not be attached and will throw an error. Is there a way to get around this? Thank,

+2


source to share


3 answers


Rename your files first? These characters are not prohibited because SharePoint is fussy, but because they mean something in the URL; does it make sense not to use? etc. in filenames because they are reserved in URLs.



+2


source


You can create an "event receiver" (see the SPItemEventReceiver class on msdn) that will watch for the ItemAttaching event that occurs before the item is attached. This will allow you to replace invalid characters with legitimate replacements.

Note that if you replace all invalid characters with the same "_", for example, this is to avoid name collisions.



-Oisin

+2


source


I was able to create a client side javascript based validation that will validate special characters and prompt the user to rename the filename before submitting the item. This works for MOSS 2007 and WSS.

See this post: http://sharepointchic.blogspot.com/2010/12/input-validation-for-file-attachment.html

+1


source







All Articles