Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How do you provision a file through a module (CAML) and choose its Content Type? Is it even possible? The normal behavior for a new item is to get the default content type.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If you look at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\PublishingLayouts\ProvisionedFiles.xml it contains the PageLayouts for publishing which is provisioned like:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="OSGPageLayouts" Url="_catalogs/masterpage" Path="PageLayouts" RootWebOnly="TRUE">
        <File Url="ArticleLeft.aspx" Type="GhostableInLibrary">
...
            <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
...
        </File>
...
    </Module>
</Elements>
share|improve this answer

I've also found an answer. Through saving a library as a site template and then importing it in Visual Studio. Also the content types fields are possible to set with the elements, which was a valuable lesson.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.