Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I implemented content type for workflow tasks.

<ContentType 
    ID="0x010801004D0E4ACA1A34472887F7CCD678E5F48C" 
    Name="$Resources:file,name;" 
    Group="Custom Content Types"
    Inherits="FALSE"
    Hidden="FALSE"
    Overwrite="TRUE"
    Description="">
    <FieldRefs>
      <FieldRef ID="{BCB0519A-DB16-4E8A-BAB1-FFF384DD2F5B}" Name="field1"/>
      <FieldRef ID="{EC2A4C3D-F453-435D-A567-16F10EECB322}" Name="field2"/>
      <FieldRef ID="{67916015-4627-4D89-A268-D4BEDEA7809E}" Name="field3"/>
    </FieldRefs>
    <XmlDocuments>
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
          <New>_layouts/folder/New.aspx</New>
          <Display>_layouts/folder/Display.aspx</Display>
          <Edit>_layouts/folder/Edit.aspx</Edit>
        </FormUrls>
      </XmlDocument>
    </XmlDocuments>
</ContentType>

Then I created my custom list with custom schema

<ListInstance Title="$Resources:file,title;"
                OnQuickLaunch="TRUE"
                TemplateType="107"
                FeatureId="00BFEA71-A83E-497E-9BA0-7A5C597D0107"
                Url="Lists/ListName"
                Description=""
                CustomSchema="Lists\ListName\Schema.xml" >
</ListInstance>

I tried to do content type reference in my custom schema

<ContentTypes>
      <ContentTypeRef ID="0x010801004D0E4ACA1A34472887F7CCD678E5F48C" ></ContentTypeRef>
</ContentTypes>

But I have behavior that is too difficult for my mind.. If I open list content types I see that the "Workflow Task" content type is created. There are a property which tells that the "Workflow Task content type is inherited from my content type.

enter image description here

Could you explain why do I see the "Workflow Task" content type? Why is it not my content type? What do I do wrong?

share|improve this question
    
are you deploying both content type and list definition in the same feature ? –  Steve B Apr 27 '12 at 13:22
    
@SteveB. no, the content type is in separate feature. –  Alexander Apr 27 '12 at 13:32
    
Another thing to consider, features content type is a very buggy part of sharepoint. if you look at what visual studio creates when you create a new list definition from a content type, the whole content type and fields are duplicated in the list definition. In a previous project, I had to duplicate everything, because SharePoint didn't seems to handle correctly ContentTypeBinding with non OOB content types. Quite a mess –  Steve B Apr 27 '12 at 13:43
    
@SteveB, plz add you comment as answer, I will mark it as correct. –  Alexander Apr 27 '12 at 20:17
add comment

3 Answers 3

up vote 0 down vote accepted

Another thing to consider, features content type is a very buggy part of sharepoint. if you look at what visual studio creates when you create a new list definition from a content type, the whole content type and fields are duplicated in the list definition.

In a previous project, I had to duplicate everything, because SharePoint didn't seems to handle correctly ContentTypeBinding with non OOB content types. Quite a mess

share|improve this answer
    
if there are many fields in "declareted content type" you can create empty content type in your list and inherit this content type from "declareted content type". In this case you should not change contentypes in all lists if you have to modify them. –  Alexander Apr 28 '12 at 6:46
add comment

Try to put the Content Type name explicitly in the Definition :

Name="$Resources:file,name;" 
share|improve this answer
    
ContentTypeRef tag does not allow name attribute. There is only one ID attribute that is available. –  Alexander Apr 27 '12 at 12:51
add comment

Look at your Content Type's ID. It starts with 0x01080100, which means your Content Type is inherited from Task Content Type ( you can check this id here http://joelblogs.co.uk/2011/06/16/sharepoint-2010-base-types-list-template-and-definition-ids-and-content-types-ids/ under the content types section ). As @Amit Kumawat suggested above, try to explicitly set Content Type's name.

share|improve this answer
    
0x0108 - is a task, 0x010801 - is a workflow task. Look at MSDN post. Also the name attribute is ignored in the ContentTypeRef tag. –  Alexander Apr 27 '12 at 14:08
add comment

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.