ContentType DocumentTemplate not found in a List

Posted by Rich Bennema on Stack Overflow See other posts from Stack Overflow or by Rich Bennema
Published on 2010-03-19T15:06:40Z Indexed on 2010/03/20 13:11 UTC
Read the original article Hit count: 695

Filed under:
|

I have the following Feature:

<?xml version="1.0" encoding="utf-8"?>
<Feature Id="9A3C5D02-A2EB-4725-97F7-CDA6DE319F1B"
    Title="My Custom Types"
    Scope="Site"
    DefaultResourceFile="core"
    Hidden="TRUE"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
        <ElementManifest Location="Elements.xml" />
        <ElementFile Location="templates/MeetingMinutes.docx" />
    </ElementManifests>
</Feature>

Which contains the following Elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Templates" Url="_cts/Meeting Minutes" Path="templates" RootWebOnly="TRUE">
        <File Url="MeetingMinutes.docx" Type="Ghostable" />
    </Module>
    <ContentType
        ID="0x01010066DD088A6B8B46BCA775CCD119FBB3E8"
        Name="Meeting Minutes"
        Group="Custom Content Types"
        Version="0">
        <FieldRefs />
        <DocumentTemplate TargetName="MeetingMinutes.docx"/>
    </ContentType>
</Elements>

I then use this ContentType within a custom List Template. I deploy the solution, activate the feature, and create an instance of the List Template. I go into the library and select Settings > Document Library Settings > Content Types: Meeting Minutes > Parent: Meeting Minutes > Advanced settings. I'm now in the Advance Settings of the Site Content Type. The URL of the existing document template is MeetingMinutes.docx and there is an (Edit Template) link which points to http://myserver/sites/testsite/_cts/Meeting%20Minutes/MeetingMinutes.docx. Everything's shiny.

But, I hit the back button two times so I'm back in the settings of the List Content Type. This time when I click Advance settings, the URL of the existing document template is still MeetingMinutes.docx, but there is no (Edit Template) link. Troubling.

Pressing on, I go back to AllItems.aspx and click New > Meeting Minutes. As Word is loading, I see a little Opening dialog which says, Opening: http://myserver/sites/testsite/Shared%20Documents/Forms/Document/MeetingMinutes.docx, to which Word responds: "Word was unable to read this document. It may be corrupt."

So the Document Template works correctly in the Site Content Type (where it does me no good), but is not working in the List Content Type (where I really need it). Now, I know I could put this in _layouts, but from what I've read, _cts is the way to do it. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about sharepoint2007