The Training Course Content Type
Collapse the table of content
Expand the table of content

The Training Course Content Type

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

A content type defines various elements that characterize your data. For example, a content type can include the metadata that is associated with the data, the workflows, and the event receivers. The Create a Course use case includes one content type that is named TrainingCourseContentType. The content type is defined in the TrainingCourseContentType.xml file located in the ContentTypes\TrainingCourseContentType folder of the Contoso.TrainingManagement project.

The TrainingCourseContentType includes seven fields and two event receivers. The following are the TrainingCourseContentType fields:

  • TrainingCourseCode. This field is for the code that identifies the course.
  • TrainingCourseDescription. This field is for the description of the course.
  • TrainingCourseEnrollmentDate. This field is for the last day that an employee can enroll in the course.
  • TrainingCourseStartDate. The date the course begins.
  • TrainingCourseEndDate. This field is for the date the course ends.
  • TrainingCourseCost. This field is for the cost of the course.
  • TrainingCourseDifficultyLevel. This field is for the course's level of difficulty.

The following XML from the TrainingCourseContentType file shows two of the fields.

<Field ID="{e5509750-cb71-4de3-873d-171ba6448fa5}" Type="Text" Name="TrainingCourseCode" DisplayName="Code" Hidden="FALSE" Required="TRUE" Sealed="FALSE" MaxLength="8" DisplaceOnUpgrade="TRUE" />
<Field ID="{8E39DAD4-65FA-4395-BA0C-43BF52586B3E}" Type="Note" Name="TrainingCourseDescription" DisplayName="Description" Hidden="FALSE" Required="FALSE" Sealed="FALSE" RichText="TRUE" DisplaceOnUpgrade="TRUE" />

The form that SharePoint generates to enter the course information is based on the field type. For example, the TrainingCourseDescription field's type is Note, so SharePoint includes a text box. For more information about each attribute, see Field Element (List — Definition) on MSDN. Each field corresponds to a column in the Training Courses list. The DisplayName attribute defines the name of the column.

The content type also has two list item event receivers named ItemAdding and ItemUpdating. For more information about them, see The List Item Event Receivers.

For more information about content types, see Content Types on MSDN.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Show:
© 2016 Microsoft