A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Thursday, March 8, 2007

Adding a field to the document library template

Update: This post has been retrieved from a web archive, there might be some dead links. Please send an email to share.point@yahoo.com if you find any dead links on this page. Thank you!
Reposted on: Aug 30, 2007 
-- 
Note: Don't forget to make backup copies of the files you modify in this tip.
1. Open schema.xml file for the document library that is located in the following path:
LocalDrive:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESDocumentLibraryDocLib
2. Locate <Fields> tag and add following field inside the <Fields> tag:

  <Field ID="{20487AC7-D872-4B10-ACB8-CF3002C29687}" Type="Text" Name="MyField" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="$Resources:core,MyField;" Filterable="TRUE" Sortable="TRUE" Sealed="TRUE"  SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="MyField"><!-- _locID@DisplayName="camlid2" _locComment="  " -->
      </Field>

Field ID should be unique. Run Select NewID() in SQL Query Analyzer to get a new GUID and use it as the field ID.
3. Open core.en-US.resx file located in the following path:
LocalDrive:Program FilesCommon FilesMicrosoft Sharedweb server extensions12Resources
4. Locate following tag in the file:
  <!-- shared resources -->
and add following lines in this section (shared resouces section)
  <data name="MyField">
    <value>My Demo Field</value>
  </data>
5. Save the changes and reset IIS. Next time when you will create a document library, this field will be a part of your document libray.
I once blogged about creating site definitions in SPS 2003. Things have changed a lot in version 2007 but this time we have lot of help available in the form of blogs, forums, etc. If you want to learn more about site definitions in 2007, read following excellent articles by Todd Baginski:

-SSA

No comments:

Post a Comment