I have a couple of document libraries that are just standard libraries - no associated custom content types or anything. I am trying to add subfolders to them and in some cases it just doesn't work.
SPFolder parent = library.RootFolder;
SPFolder child = parent.SubFolders.Add(subfoldername);
parent.Update();
bool exists = child.Exists; // This is false
When I try to add a subfolder called M1 Spectrum CRC w-out CMN67 E02_files
via code it fails to add the folder, even though the Add
method seems to execute successfully. When I try to add a folder of this exact name via the standard browser-based SharePoint list UI, I successfully get a folder added but it has a different name:
M1 Spectrum CRC w-out CMN67 E02_files_
Note the trailing underscore in the folder that SharePoint created. This is a legal Windows folder name and it doesn't contain any html-unfriendly characters. So, what's up with this? Am I missing something obvious?