I am using the SharePoint Client Object Model to get information from a SharePoint 2010 document library to be able to delete old htm-files located there. The problem is that these htm-files have hidden "_files"-folders associated to them. I am not able to find these folders using the SharePoint Client Object Model, they just don't show up. I can see them in Windows Explorer using WebDav, but not in SharePoint. They don't get deleted if I just delete the .htm-file.

 using (ClientContext context = new ClientContext(webUrl))
            Web web = context.Web;
            context.Credentials = System.Net.CredentialCache.DefaultCredentials;
            Folder fldr = web.GetFolderByServerRelativeUrl(serverRelativeFolderUrl);
            foreach (Microsoft.SharePoint.Client.Folder folder in fldr.Folders)
            { // no hidden folders found here, only usual folders

1 Answer 1


According to http://blogs.msdn.com/b/findnavish/archive/2011/11/16/some-specific-folder-or-files-not-getting-created-in-sharepoint-thickets.aspx and http://social.technet.microsoft.com/Forums/windows/en-US/d6c187ab-3d70-4357-878f-018b9731c161/sharepoint-folder-with-an-underscore-contained-within you shouldn't be able to upload the folders without getting renamed to *_files_. Are the folders there without the trailing underscore?

If yes, and you somehow really created thickets you won't see them - they won't reveal as they are beliefed as "internal" and never be listed in the OM. You can still delete them though:

SPFolder folder = web.GetFolder("Documents/google_files")
//while folder.Exist is false the folder could still exist but be hidden

This won't throw an exception if the folder is not found and delete if it exists.

Edit, after finding out that you are searching for a method to do this automatically

You could create an EventReceiver that handles the situation of a file getting deleted and delete the ticket folder to the .htm file accordingly. In the example on http://msdn.microsoft.com/en-us/library/ms453149.aspx they are canceling the ItemDeleting event, you just have to catch the event occuring in the libraries you want (The event will fire on all items in a web) and delete the thicket.

Just a hint when doing so, Sharepoint Manager (http://spm.codeplex.com) is a great tool that helps you stumbling through the objects on your SharePoint. It has done a great job for me when i was deploying features and custom Receivers into SharePoint.

  • I am able to upload the thickets without them getting renamed, using the SharePoint Webservices. This also is the behaviour I want. The issue is that the .htm-files were deleted using the SharePoint website, so if I want to delete the _files I would need to find the folders as I don't know the .htm-file anymore. Our current workaround is a manual webdav-search. This also has the disadvantage of the files being in the recycle bin for 30 days after deletion - the web frontend is not able to delete these 1000s of files from the bin without timing out. Jul 29, 2014 at 11:18

Your Answer

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

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