You can specify a content type in the website definition so that WSS makes the content types available by default whenever you create a website of this type.
The site definition can be included in a feature.
After creating a website, you can use the WSS object model to add a content type to the website.
Specify content type in site definition
If you want to specify a content type in the site definition, You can first create a separate feature for the content type, and then reference the feature in the site definition.
Steps:
- Create a separate feature for the content type.
- Reference the website-defined feature:
In the feature defined by the outlet, open the XML file that defines the website.
In the project element, add a reference to the content type feature under the categories and Category elementsSitefeaturesOrWebfeaturesElement. For example:
< Sitefeatures >
< Feature ID = "00bfea71-1c5e-4a24-b310-ba51c3eb7a57" />
< Feature ID = "695b6570-acdc-4a8e-8545-26ea7fc1d162" />
</ Sitefeatures >
< Webfeatures >
< Feature ID = "00bfea71-4ea5-48d4-a4ad-7ea5c011abe5" />
< Feature ID = "00bfea71-e717-4e80-deaf-d0c71b360101" />
</ Webfeatures >
Add the content type to the created website
You can use the object model to add content types to an existing website.
Steps:
- UseAvailablecontenttypesMethod to access all available content types on the website. This method returnsSpcontenttypecollectionObject.
CreateSpcontenttypeClass Object.
UseAddAdd MethodSpcontenttypeObject To the content type set of the website.