Wednesday, March 25, 2009

Creating List Instance with Default values

Scenario:
I wanted to create a list instance in my site definition with some properties already set including no crawling and hidden.

Solution:
Schema support setting lot of properties.

Code:

<ListTemplate Name="SpecialDocumentLib"
DisplayName="SpecialDocumentLib"
Description="SpecialDocumentLib"
SetupPath="SpecialDocumentLib" Type="101" BaseType="1" Hidden="TRUE"
HiddenList="TRUE" NoCrawl="TRUE" FolderCreation="FALSE" Unique="TRUE"
RootWebOnly="FALSE" Catalog="FALSE" OnQuickLaunch="FALSE" SecurityBits="11"
AllowDeletion="FALSE" Image="/_layouts/image/specialdoclib.gif"
DontSaveInTemplate="TRUE" DocumentTemplate="100" />
</ListTemplates>
Note:
Hidden=TRUE will hide the list definition from the Create page.
and
HiddenList=TRUE will hide the list instance you have created using this list definition.

0 comments: