_files folder (part 1) – what’s special about it

If you create a folder in Sharepoint named like myfilename_files, this folder will be hidden on the UI. Many MS generated HTM files have this supporting folder.

(Note: you will not be able to create this kind of folder through Sharepoint UI, in which case an extra underscore will be appended to the folder name. You have to do it through API.)

If you do something like this:

SPFolder folder = web.GetFolder( “Shared Documents/myfilename_files”)

You will get folder.Exist is false. It seems that Sharepoint doesn’t want to reveal the existence of the folder. However you can delete the folder:


No exception will be thrown if the folder doesn’t exist, and sub folders and files will be deleted altogether. So do it carefully.

This screen dump of the properties of such a folder will help us to understand it better:

=======================web.GetFolder(“Shared Documents/myfile_files”)
{Shared Documents/myfile_files}
Audit: {Microsoft.SharePoint.SPAudit}
ContainingDocumentLibrary: {f0ba6962-57bd-42d1-b243-1a3ab63cb20f}
ContentTypeOrder: Count = 1
Exists: false <-note this
Files: {Microsoft.SharePoint.SPFileCollection}
Item: null
Name: “myfile_files”
ParentFolder: {Shared Documents}
ParentListId: {f0ba6962-57bd-42d1-b243-1a3ab63cb20f}
ParentWeb: {DMS(Demo Live Site)}
Properties: null <-note this
ServerRelativeUrl: “/Shared Documents/myfile_files”
SubFolders: {Microsoft.SharePoint.SPFolderCollection}
UniqueContentTypeOrder: ‘web.GetFolder(“Shared Documents/myfile_files”).UniqueContentTypeOrder’ threw an exception of type ‘System.NullReferenceException’ <-note this
UniqueId: ‘web.GetFolder(“Shared Documents/myfile_files”).UniqueId’ threw an exception of type ‘System.NullReferenceException’ <-note this
Url: “Shared Documents/myfile_files”
WelcomePage: ‘web.GetFolder(“Shared Documents/myfile_files”).WelcomePage’ threw an exception of type ‘System.NullReferenceException’ <-note this


This type of folder will not be listed under SPFolder.SubFolders collection.

This entry was posted in Document library and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s