1

Firstly, I'm fully aware of questions/answers such as Which special Characters are not Allowed in SharePoint 2013 Files\Folders.

When I programmatically (via C#, SP client) create a new document library with parentheses in its name (, ) or a dash -, these characters simply get removed from the new URL. Right after I create the document library, I try to populate it with some data. However, it throws an error saying that no such document library exists, because I'm trying to access it via its old name (i.e. with parentheses and dashes).

To me, it appears that this removal happens automatically without any warning. So far I have discovered these 3 characters, but perhaps there are more.

Is there a list of characters that get removed automatically without causing an error from the document libraries' URL names?

Example: New Folder - Copy (10) becomes New Folder Copy 10

Thanks

2 Answers 2

1

If a Document Library or List is given a title that contains a comma, any bracket, period or dash ( , ( ) . – ), they will be removed from the URL.

You can find reference here

So you can write some magical codes(Regular Expression) to remove or replace such character.

0
0

This may be entirely obvious, but... the first library, folder, or file name assigned starts off as a URL. If you wanted to retain the special characters, I'd assume you needed to start the characters off as HTML encoded.

In general, I try to keep the urls as short as possible. If I was creating a document library via API, and wanted special characters in the Title, I'd first create the library with a short url. Then grab it again once it was instantiated, then hit the title up with the more complex name, which should bypass any issue with it taking out the special characters.

2
  • Hi, thanks for the answer. My problem isn't that I want to keep the special characters - in fact I'm completely fine with them being removed, however, I want a predictable behavior, meaning I want to know which characters will get removed (or at least get notified that some of them got removed). At the same time, I guess I could simply make a custom/random URL name, but I'd like to keep the URL name as close to the actual name as possible.
    – leopik
    Feb 27, 2017 at 10:31
  • I can't think of any special character that wouldn't be removed. In a case where I needed to create libraries from a spreadsheet or something, I would run it through a regex filter first, then export the modified name back to the spreadsheet. for reference. Meaning, instead of letting it happen automatically, do it on purpose so you can still control and document the results.
    – Jack
    Feb 27, 2017 at 11:00

Your Answer

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

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