Associating a document template with the content type
In the introduction to content types, we specified that a content type can include document templates and/or workflows. In this recipe, we will include a document template for our Project
Proposal
content type.
Getting ready
You should have completed the previous recipes successfully. Create a word template and name it ProjectProposal.dotx
.
How to do it...
If you have closed Visual Studio IDE, launch it as an administrator.
Open the previously created ProjectProposal solution.
Right-click on the project and select Add | SharePoint "Layouts" Mapped Folder as follows:
This will create a mapped folder to the Layouts folder and add a subfolder with the same name as the project underneath it. In our case it is called ProjectProposal.
Add your
ProjectProposal.dotx
file to this folder. Your project structure should be as follows:Open
Fe
ature1.EventReceiver.cs
file and add code to associate the document template before the content type update method...