Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have defined my list definition as following:

<List xmlns:ows="Microsoft SharePoint" Title="Requests List Definition" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/RequestsListDefinition" <MetaData>
<ContentTypes> 
  <ContentType ID="0x010078bed2b1dce44a12a759eeca0717f323"
               Name="Request"
               Group="BrmpTool Content Types"
               Description="BrmpTool Request Type"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <!-- Requirement high level description -->
      <FieldRef ID="2a7a1ab2-3085-4141-8fbd-75e5ee439c2a" />
      <!-- Rough Estimation – Internal IT Technical -->
      <FieldRef ID="26722be1-ed56-4619-80f1-1c8c5d9bde02" /> 

And the fields are defined lower in the same List definitions

<List itle="Requests List Definition" Url="Lists/RequestsListDefinition">
<MetaData>
    <ContentTypes> Declared above </ContentTypes>
    <Fields>
       <!-- Request columns-->
       <Field Name="RequirementHighLevelDescription" Type="Note" Required="TRUE" DisplayName="Requirement high level description" StaticName="RequirementHighLevelDescription" NumLines="10" RichText="FALSE" Sortable="FALSE" ID="2a7a1ab2-3085-4141-8fbd-75e5ee439c2a" SourceID="http://schemas.microsoft.com/sharepoint/v3" DisplaySize="" Description="Requirement high level description" />
      <Field Name="RoughEstimationInternalITTechnic" Type="Number" Required="FALSE" DisplayName="Rough Estimation – Internal IT Technical" StaticName="RoughEstimationInternalITTechnic" Decimals="0" ID="26722be1-ed56-4619-80f1-1c8c5d9bde02" SourceID="http://schemas.microsoft.com/sharepoint/v3" Description="Rough Estimation – Internal IT Technical" />

Should i put the actual field definitions in a separate Element.xml file and only reference them in the content type thus removing field definitions from List->Fields ?

The main idea is that i want my list to use content types.

If I place the Field definitions in a separate Elements.xml and deploy it, will these fields get created as Site Columns?

My list is the only one who's gonna be using this content type.

Thanks!

Update:

Please see this taken from msdn

It would seem that I defined it correctly, although as per image I'm guessing i should add a third declaration at Site level (probably in a second Elements.xml).

Well I haven't done that in my example, so what does that mean (coz it works? wore the fields automatically added as Site Columns ?

share|improve this question

2 Answers

There should be a definition of the fields in the Content Type, and you also need to reference both the Content Type AND the FieldRef's in the Content Type your are referencing from your List Definition.

http://blogs.msdn.com/b/mcsnoiwb/archive/2008/12/01/creating-list-definitions-with-content-types.aspx?Redirected=true

share|improve this answer

Instead of manually handcrafting the XML, I always go the export / Import wsp route. This way, the list with all of its dependencies such as the content type and columns will be imported. this works perfect in SharePoint 2010.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.