R – How to create a custom document library in SharePoint

document-librarysharepoint

I am wanting to create a Custom Document Library for the purpose of targeting a custom action feature to the Custom Document Library's New Menu.

I have found many different guides on the internet, but you know how old those can be.

So what would be the "correct" way to create a custom document library in SharePoint 2007.

Thank you,
Keith

Best Answer

I have taken the approach of copying the OOTB DocumentLibrary folder and files structure from the 12hive\TEMPLATE\Feature directory, changing some of the default files to make this a new CustomDocumentLibrary, and wrapping the new files and folders up as a feature to be deployed with stsadm.

Feature.XML File

  1. Create a new GUID and change the original Id attribute to this new GUID.
  2. Change the Title and Description attributes in the feature.xml file to its new name and change the hidden attribute from true to false.
  3. Update the ElementManifest node to point to the name change in the ListTemplates file.

ListsTemplate Folder

  1. Change the ListTemplate file name from DocumentLibrary.xml to my new CustomDocumentLibrary.xml
  2. Change the Name attribute of the CustomDocumentLibrary.xml match the new name library name (CustomDocumentLibrary).
  3. Change the Type attribute from 101 (document library) to 10055 (you pick and don't duplicate), the new custom list type's ID

DocumentLibrary Folder

  1. Rename the doclib folder to match the new name of the document library (CustomDocumentLibrary). The new folder name should be the same as the Name attribute in the liststemplate file.
  2. Keep the EditDlg.htm, filedlg.htm, repair.aspx, schema.xml, and upload.aspx files in the folder.