tags:

views:

515

answers:

2

How can I use a feature to create a document library to be used to add Web Part Pages to?

When I try to create a list using the following elements.xml and a copy of the FEATURES/DocumentLibrary/doclib/schema.xml with my own name and URL, the library is not listed in the Save Location on the Create New Web Part Page page.

    <ListTemplate
      Name="PageLibrary"
      Type="20001"
      BaseType="1"
      OnQuickLaunch="TRUE"
      SecurityBits="11"
      DisplayName="Page Library"
      Description="Content Pages"
      Image="/_layouts/images/itdl.gif"
      DocumentTemplate="101"
      AllowEveryoneViewItems="TRUE"
      Catalog="TRUE"
      Category="Libraries"
    />

    <ListInstance 
      TemplateType="20001"
      Id="Pages"
      Title="Content Pages"
      Description="Web Site Content Pages"
      Url="Pages"
      OnQuickLaunch="True"  
    />

It looks like setting Catalog to true should have done this for me, but it did not work.

A: 

Keep the Type="101" to the default value of the Document Lib Itself. You should get what you want. The spcf.aspx looks only for the Doc Lib of Type 101

Kusek
That worked. I thought I was not supposed to re-use the types, but it looks like they just need to be unique within the feature.
Joosh21
We can , You will need to change the type when you want to hook a Eventhandler so something like that .
Kusek
+1  A: 

I figured out a workaround... Since I am not making any changes to the DocumentLibrary list schema, i can just reference that list and only need a ListInstance element that references the DocumentLibrary feature and list TemplateType. So my Elements will now look like this:

  <ListInstance
    FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101"
    TemplateType="101"
    Id="Pages"
    Title="Content Pages"
    Description="Web Site Content Pages"
    Url="Pages"
    OnQuickLaunch="True"
  />
Joosh21
This should be the accepted answer, and its worth noting to other readers: that FeatureID is the same for all MOSS installations.
JL