In my last post I alluded to a time-off request solution that uses Microsoft Office Word 2007 as a form application. Here, I will begin the process of documenting how that solution was built. This post, the first in a four-part series, will focus on the creation of a Microsoft Office SharePoint Server (MOSS) 2007 content type.
Before I begin, let me quickly explain how the time-off request solution works. There are two user roles for this solution: the employee and the employee’s manager. The employee starts the process by navigating to the Time-Off Request SharePoint document library and starting a new Office Word 2007 document template. The template is associated with a MOSS content type and allows the employee to identify himself, his contact information, his manager, and his manager’s contact information. In addition, the employee must specify a start date, return date, and type (e.g., vacation, floating holiday) for the time-off request before saving the document to the Time-Off Request document library. A workflow that is attached to the document library is triggered and notifies the employee’s manager that there is a new time-off request. The employee’s manager then reviews the time-off request, which is copied by the workflow to a separate Time-Off Request Status document library, which references the same content type used in the Time-Off Request document library. The employee’s manager approves or rejects the time-off request, specifies the number of business days taken off, and saves the document back to the Time-Off Request Status document library. A workflow attached to that library is triggered that notifies the employee of whether the request was approved or not. In the event of an approval, the workflow also updates a custom SharePoint list, which contains vacation and floating holiday balances for each employee.
Now that you have a general overview of the solution, let’s get on with content type creation. This solution uses a number of fields in the time-off request document template, including some for contact information, start and return dates, and time-off type and status. All of these fields are mapped to site columns, which comprise the metadata for a site content type and define the data model for a corresponding Office Word 2007 document template. So, I will begin by navigating to the Site Settings page for my Human Resources site collection. From there, I click Site columns and then click Create as needed to create all of the site columns. The figure below shows the custom site columns that are used in the solution.
The TimeOffType and TimeOffStatus columns each have a “choice” data type. The values for the TimeOffType column are Vacation, Floating Holiday, and Other. If the employee selects Other, then he can provide an explanation using the TimeOffOtherReason column. The values for the TimeOffStatus column are Open, Approved, and Rejected. If the employee’s manager selects Rejected, then she can provide an explanation using the TimeOffRejectionReason column.
With the columns in place, I can now create the site content type for time-off requests. Again, I navigate to the Site Settings page for my Human Resources site collection. This time, I click Site content types and then click Create to define a new site content type. On the New Site Content Type page, I type a name in the Name box, select Document Content Types in the Select parent content type from list, select Document from the Parent Content Type list, and click OK.
After you have defined the content type, on the Site Content Type page, click Add from existing site columns to include the custom site columns you created earlier. Then, on the Add Columns to Site Content Type page, select the custom site columns from the Available columns list, click Add, and click OK.
The new content type can be referenced from any document library in my Human Resources site collection. For this solution, the new content type is used in both the Time-Off Request and Time-Off Request Status document libraries. To add the new site content type to one of these libraries:
- From the document library, click Settings | Document Library Settings.
- In the General Settings section, click Advanced settings.
- In the Content Types section, click Yes to allow for the management of content types and click OK.
- In the Content Types section, click Add from existing site content types.
- On the Add Content Types page, click Time-Off Request from the list of available site content types, click Add, and click OK.
Once the site content type has been added for both document libraries, you can start creating the time-off request document template. In Part 2 of this series, I will show how to use content controls and grouping in Office Word 2007 to make this template act more like a form.