views:

2143

answers:

3

Hi. I am developint a Sharepoint Solution, that implements a new list. This list has an event receiver attached to a Custom Content type.

I am using VSeWSS 1.3 for this task and it's going ok (the content type gets created, a list is created and bound to the content type, the event receiver triggers successfully.

My only concern is that in the created list, it always show the base Content Type (Item CT with Title field). Through the Web GUI I can hide this content type, but I can't find where to do that in my XML definitions, or make it on the solution to avoid double tasks when deploying.

Any suggestions??

A: 

You will have to edit the Schema.xml for your custom list. Find the <ContentTypes> tag and remove any you do not wish to be shown.

Your list definition will have a guid (eg. <Elements Id="0a8594c8-5cf1-492e-88ce-df943830c88c") that will specify the list from the schema xml (e.g.<List Name="... ...Id="0a8594c8-5cf1-492e-88ce-df943830c88c">)

I am not sure what the implementation is for, usually there is a feature.xml to combine the previous xml files together (e.g.<ElementManifests><ElementManifest Location="MyFeature\ListDefinition.xml" /><ElementFile Location="MyFeature\schema.xml" />)

Nat
Thanks Nat. I tried that, but it doesn't work correctly. My definition has 3 xml files: ListDefinition, Implementation and Schema .... what is the relation between the schema and the other 2??
Nicolas Irisarri
A: 

In the schema.xml you need to make 2 changes

in the <List> element add the following attribute:

EnableContentTypes="TRUE"

the <ContentTypes> element should contain a <ContentType> element that specifes your custom Content type.

for example:

<?xml version="1.0"?>
<List 
  xmlns:ows="Microsoft SharePoint" 
  Title="List_Title" 
  FolderCreation="FALSE" 
  Direction="$Resources:Direction;" 
  Url="Lists/List_Title" 
  BaseType="0" 
  Name="List_Title" 
  Id="51D716AC-DF9D-4ebb-9F8E-9134EEBB7C39" 
  Type="100" 
  xmlns="http://schemas.microsoft.com/sharepoint/"
  EnableContentTypes="TRUE"
>
  <MetaData>
    <ContentTypes>
      <ContentTypeRef ID="0x01..." />
    </ContentTypes>
Jason
A: 

Both answers helped me, but I found also that You need to spewcify the columns again in the List Definition (not only in the Content Type), because otherwise, they won't show up in the list.

Nicolas Irisarri