[转]Provision master page and page layouts via CAML

原文链接:http://www.cnblogs.com/zhalin/archive/2008/03/03/1089403.html

 

用CAML来Provision file时,如果文件是PageLayout,则需要指定Title,ContentType和PublishingAssociatedContentType。
ContentType 永远是同一个值 $Resources:cmscore,contenttype_pagelayout_name; 在resx文件里可以看到这个值= "Page Layout"。
PublishingAssociatedContentType指定这个Layout所使用的Content type,格式是 ;#<content type name>;#<content type GUID>;#

<Module Name="ProvisionPageLayouts" List="116" Url="_catalogs/masterpage" Path="PageLayouts">
   
<File Url="MyLayout.aspx" Type="GhostableInLibrary" >
      
<Property Name="Title" Value="My Layout" />
      
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
      
<Property Name="PublishingAssociatedContentType" Value=";#My Content Type;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900B8BDF58127F049ECB459BECAC88250E1;#"/>
   
</File>
</Module>

如果是上传master page,则这样:

<Module Name="ProvisionMasterPages" List="116" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="True">
    
<File Url="Mymaster.master" Type="GhostableInLibrary">
      
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_masterpage_name;" />
      
<Property Name="MasterPageDescription" Value="Your Description" />
    
</File>
</Module>


<Module>中List=“116” 适用于master page和Page Layout, url指在sharepoint网站上的虚拟目录地址,文件将被上传到那里。Path指本地相对地址,要上传的文件在这里。

 

posted on 2008-09-27 17:59  王丹小筑  阅读(222)  评论(0)    收藏  举报

导航