Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to add a new column field to a custom document library

  Asked By: Ravi    Date: Jan 29    Category: Sharepoint    Views: 2199

The client has asked to add a new field to a group of document libraries
that are programmatically created using the features logic (I have the
code to create the document libraries below).

I also created a feature for the new fields that I want (also listed
below).

How do I get the document library to include the new field?

Feature.xml (document library)

<?xml version="1.0" encoding="utf-8"?>
<Feature Id="2053BFFA-5595-4e87-A17E-25E83A0AFB6A"
Title="$Resources:PWBOOKLibrary,PWBOOKLibrary_Title_1;"
Description="$Resources:PWBOOKLibrary,PWBOOKLibraryDescription_1;"
Version="1.0.0.0"
Scope="Web"
Hidden="TRUE"
DefaultResourceFile="PWBOOKLibrary"
xmlns="http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/
<http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/> ">
<ElementManifests>
<ElementManifest Location="ListTemplates\ListCreation.xml" />
</ElementManifests>
</Feature>

ListCreation.xml (document library - partial listing)

<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="12.0.3820" _dal="1" -->
<!-- _LocalBinding -->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/
<http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/> ">
<ListInstance
Description = "$Resources:PWBOOKLibrary,PWBOOKLibrary_Folder02;"
FeatureId = "00BFEA71-E717-4E80-AA17-D0C71B360101"
Id = "12102"
OnQuickLaunch = "TRUE"
RootWebOnly = "FALSE"
TemplateType = "101"
Title = "$Resources:PWBOOKLibrary,PWBOOKLibrary_Title02;"
Url = "$Resources:PWBOOKLibrary,PWBOOKLibrary_Url02" >
</ListInstance>
</Elements>


Feature.xml (new field column)

<?xml version="1.0" encoding="utf-8"?>
<Feature Id="27D9B21A-522A-463e-A7E7-8217D252F9F5"
Title="$Resources:PWBOOKLibrary,fieldswssPWB_Title01;"

Description="$Resources:PWBOOKLibrary,fieldswssPWB_Description01;"
Version="12.0.0.0"
Scope="Site"
DefaultResourceFile="PWBOOKLibrary"
xmlns="http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/
<http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/> ">
<ElementManifests>
<ElementManifest Location="fieldsPWB.xml" />
</ElementManifests>
</Feature>


fieldsPWB.xml (new field column - partial listing)

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/
<http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/> ">
<Field ID="{A02C1850-60CB-42be-89EB-3DDF8CA44B8C}"
Name="Overview"
Type="Choice"
Group="$Resources:PWBOOKLibrary,fieldswssPWB_Group01;"

DisplayName="$Resources:PWBOOKLibrary,fieldswssPWB_DisplayName01;"
SourceID="http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/v3/fields
<http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/" target="_blank" rel="nofollow">http://schemas.microsoft.com/sharepoint/v3/fields> "
StaticName="Overview"
Required="TRUE"
FillInChoice="FALSE">
<CHOICES>
<CHOICE>Contact List</CHOICE>
<CHOICE>Policies/Procedures</CHOICE>
</CHOICES>
<Default> </Default>
</Field>
</Elements>

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How to add a new column field to a custom document library Or get search suggestion and latest updates.




Tagged: