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.

2 Answers 2


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;" />

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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