A.5. Building a Custom Content Type Using VSeWSS

The content type that the policy management site will use will have several custom fields defined that will appear in the available site columns' page after they are provisioned (see below table). Each of the fields that is being created will be referenced by the content type in the <FieldRefs> node (See Listing A-6) by using the ID and Name that is provided within the <Field> element of in Policies.Field.xml (see Listing A-7). When you define the content type using VSeWSS, it will generate the contenttype.xml and the contentype.fields.xml file, already providing a sample field element that can be used as a boilerplate for further field integration.

Element Field (Column) NameField (Column) TypeField Description
Policy IDNumberRelevant Policy ID
Policy NameSingle Line of TextFriendly Policy Title
Effective Policy DateDate and TimeDate of Policy Enforcement

The following code defines the policy library content type with the ancestral attribute of the content type (0x0101, in this case, specifying a document library), the content type description attributes, the content type references to the three custom fields as defined by the Policies.Field.xml (see Listing A-7), and associated SharePoint listform pages for interacting with the policy library (see Listing A-6).

Example A.6. Policies.xml (policies content type)
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!--document library ancestral ...

Get Professional SharePoint® 2007 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.