The file or folder name contains characters that are not permitted SharePoint 2013. Removing the invalid characters using Regex C#.
Views (2695)
Was getting the below error while uploading attachment to SharePoint document library.

string pattern = "[\\~#%&*{}/:<>?|\"-]";
string replacement = " ";
Regex regEx = new Regex(pattern);
string sanitized = Regex.Replace(regEx.Replace(input, replacement), @"\s+", " ");
Helpful post
http://simplyaprogrammer.com/2008/05/importing-files-into-sharepoint.html
Hope it helps
Filed under: SharePoint, SharePoint 2010, SharePoint 2013 Tagged: SharePoint, SharePoint 2010, SharePoint 2013
This was originally posted here.

Like
Report
*This post is locked for comments