The Registration List
The Register for a Course Use Case relies on a registration list. The registration list contains course registration requests. It is defined by the following XML files:
- Schema.xml
- RegistrationListTemplate.xml
- RegistrationListInstance.xml
The Schema File
The Schema.xml file is located in the ListDefinitions\RegistrationListDefinition directory of the Contoso.TrainingManagement project; it defines the views, forms, toolbar, and special fields for lists that are created with the List Definition template. The schema is used wherever the associated SPList instance occurs. It includes definitions of four views, identified as BaseViewID=0, BaseViewID=1, BaseViewID=2, and BaseViewID=3. The default.aspx page is BaseViewID=0. The BaseViewID=1 is the All Items page.
The BaseViewID=2 view is used when the Registrations List View Web Part is provisioned on the training dashboard. This view uses the ViewFields element to display the registration status of the employee who is logged on. The registration status is one of the fields defined in the content type. The following is the ViewFields element.
<ViewFields>
...
<FieldRef Name="RegistrationStatus">
</FieldRef>
</ViewFields>
A query retrieves the course registration. The following code shows the query.
<Query>
<Where>
<Eq>
<FieldRef Name="User" />
<Value Type="Integer">
<UserID />
</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name="RegistrationStatus" />
</OrderBy>
</Query>
For information about the Value element, see Value Element (Query) on MSDN.
The BaseViewID=3 view is used when the Registration List View Web Part is provisioned on the manager dashboard. This view uses the ViewFields element to display registrants whose registration status is Pending. The following is the ViewFields element.
<ViewFields>
...
<FieldRef Name="User">
</FieldRef>
<FieldRef Name="RegistrationStatus">
</FieldRef>
</ViewFields>
A query retrieves the employee's course registrations that are pending. The following code shows the query.
<Query>
<Where>
<Eq>
<FieldRef Name="RegistrationStatus" />
<Value Type="Text">Pending</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE">
</FieldRef>
</OrderBy>
</Query>
For more information about SharePoint lists, see SPList Class (Microsoft.SharePoint) on MSDN. For more information about the SharePoint query syntax, see Query Element (Query) on MSDN.
The Registration List Template
The ListDefinitions\RegistrationListDefinition\RegistrationListTemplate.xml file in the Contoso.TrainingManagement project is the template for the Registrations list.
The Registration List Instance File
The ListDefinitions\RegistrationListDefinition\RegistrationListInstance file in the Contoso.TrainingManagement project defines a feature ID that establishes a deployment dependency. This means that an instance of the registration list appears when you deploy the application.