One of our customer came with a requirement of hiding the new menu folder option from the document library instances by default.
This can be done through UI as well but customer don't want to do this manually through UI. By default folder creation is enabled in UI.
The New folder button appears because of "Folder" Content type (0X0120) associated with the document library definition and as well the "FolderCreation" attribute is set to TRUE by default in the document library definition.
If we create a new custom document library definition and set the "FolderCreation" attribute to False in the schema for the "List" element then we can hide the "New Folder" creation in the document libraries. Create a custom document library definition by copying the OOB document library definition and set the "FolderCreation" attribute to False in the schema for the "List" element. This will completely hide the New Folder option under New menu and as well you can check in the UI that "Folder" creation is set to "No" by default.
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="$Resources:shareddocuments_Title;" Direction="$Resources:Direction;" Url="Shared Documents" BaseType="1" FolderCreation=”False”>
<Folder TargetName="Forms/Document" />
<ContentTypeRef ID="0x0120" />
Install and activate the custom document library definition and create a new document library instance from the custom document library definition. Now you can find that the document library instances created from the custom document library definition are not having the “New Folder” option under the New menu in the toolbar. If you browse to the document library setting you can find that the folder creation option is set to false by default and if required you can enable it by changing the settings.
Note : Don't remove the folder content type from the document library definition or don't set the "FolderCreation" attribute in the "ListTemplate" element in the element manifest. Because it completely removes the folder creation and folder content type from the doc lib definition which can cause some problem in future. Its always better to override this property directly in the schema rather than in the definition so that we can keep the folder feature and just hide it.