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?
The document library is a “container” into which documents are placed. Folders can be created within a document library for further organization. Documents are stored on the server, so they're easily accessible and editable by members of the site.
You can manage sharing of your OneDrive file or folder in more detail by selecting the option, “Manage access” when you right click on a file or folder.
This is because a folder ending with _files is a special kind created by the MS Office client apps when saving a document as HTML. The Office apps saves all the Web page resource files like images and css files to this folder. But it cannot be manipulated through the SharePoint Object Model - a real mess if you ask me! Only solution for you is to NOT create folders ending with _files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With