none
Getting a Schema.Xml for a List Definition to generate a valid ContentTypeID for included Content Types. RRS feed

  • Question

  • I'm having an issue lately building a list definition in visual studio with a Custom Content Type that inherits from item 0x100.

     

    1.  I created some site columns

    2.  I created a content type called MyUser

    3.  I added the FieldRef's to the content type for my site columns

    4.  I added the elements.xml file that contains those to a feature called SitePrep

    5.  I added a List Definition From Content Type using MyUser as the content type

    6. I add a List Instance using my List Definition

    7. I created a Feature called List Definitions and put my List Definition in there

    8. I created a web feature called List Instances and put my List Instance in there.

    9. I set feature dependencies so that the List Instance feature depends on the List Definition Feature and the List Definition feature depends on the Site Prep Feature.

    Finally I deploy that,

    I'm trying to use Nintex to make some workflows for my list (not a microsoft product), but bear with me.  Nintex is unable to see my content type on my List Instance created from my List definition with my content type and site columns.  It only lists "Item".

    None the less if I go into List Settings on my list everything seems to be in order.

     

    Now the content type in my schema, looks like this

    <ContentType ID="0x0100FA4F709775234B67B4C5ED04EBCE2C93" Name="MyUser".....

     <FieldRefs>

      .....

     </FieldRefs>

    </ContentType>

    But when you add a COntent Type to a list, sharepoint appends another guid onto the end of it, I call this a "List ContentTypeID"  Where it gets that guid from or what determines what that guid needs to be I don't know.

     

    So in powershell, I did something like

    $web = Get-SPWeb http://blah

    $list = $web.Lists["MyCustomListInstance"]

    $ct = $list.ContentTypes["MyUser"]

    $ct.ID

     

    The Id it spits out has a guid tacked onto the end of my SPContentTypeID so it did generate the third guid to make it a list content type ID,

    But I think it's Invalid,


    Reason being,

    If I create a custom List in sharepoint from Item, then enable content types on it and add "MyUser" to it and remove "Item" from it, I can go into nintex and it sees my Content Type as expected.

     

    So it seems the List Content Type ID being genenerated when A list is build via Xml and Visual Studio Features is Invalid,  Does anyone know of any magic Attributes I might be missing from my List Schema?

     


    My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
    Tuesday, November 15, 2011 7:48 PM

All replies

  • For now,

    I do everything I did above, but instead of making a List Definition from my content type I make a list definition from a Custom List,

    Then in my feature receiver, I add the content type to the list myself.

     

    This seems to solve the issue, but I want users to be able to click "more" on site actions and create a new list off the definition, in order to do that I would have to add the content type in an event receiver after the list is created.


    My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
    Tuesday, November 15, 2011 7:50 PM
  • Could It also be quite possible that the site columns, content types, and list definitions need to all be apart of the same feature?

    My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
    Tuesday, November 15, 2011 7:50 PM