0

What is the best way to remove illegal characters from sharepoint(MOSS) filenames, foldernames, urls, etc...

Basic character removal process is not enough...

Thanks in advance SAV

2

You can use the SPEncode class to do what you want.

Your choices are :

SPEncode.HtmlEncode(string);
SPEncode.HtmlEncodePreserveSpaces(string);

Good luck !

See : http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.spencode_methods.aspx

  • That doesn`t remove common illegal characters which SharePoint cant eat example [ ~ # % & * { } \ : < > ? / + | " . _ ] – SAV Oct 27 '10 at 19:20
  • RegularExpression is useful for that but...I think there is no built in method for that in SP API – SAV Oct 27 '10 at 19:23
  • geek.hubkey.com/2008/11/… – SAV Oct 27 '10 at 19:25
  • Found answer and method snippet exampl about the whole thing... sharepoint-insight.com/2010/06/17/… Great example and blog post about it – SAV Oct 27 '10 at 19:32
  • It is useful for files and folders. Bu you should keep the Encode methode for the URL ! Thanks for the links, they are interesting ! – Sébastien Levert Oct 27 '10 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.