模块
上次修改时间: 2008年5月31日
适用范围: SharePoint Foundation 2010
按照类似于在 Onet.xml 文件中定义模块的方式在元素指令清单中定义模块,以便指定用于设置 SharePoint 网站的文件。
可以将零个或多个 File 元素作为 Module 元素的子级。使用 AllUsersWebPart 元素可指定给定页面内部的 Web 部件实例(列表视图 Web 部件除外)。View 元素指定要在网站页面上使用的列表视图 Web 部件。NavBarPage 元素声明包含此元素的页面应加入到导航栏结构中。Property 元素用于指定功能的自定义属性。
元素指令清单使用下面的架构:
在 Onet.xml 文件内使用以下架构:
View
示例
下面的示例将注册一个指定自定义属性的 Web 部件功能:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<Module Name="WebPartPopulation" Url="_catalogs/wp" RootWebOnly="TRUE">
<File Url="MyWebPart.webpart" Type="GhostableInLibrary">
<Property Name="MyGroup" Value="Business Information" />
<Property Name="MyLocation" Value="Middle Right" />
</File>
</Module>
</Elements>
下一示例注册一个功能,其中包含两个文件并指定要在其中的一个页面上显示的列表视图。
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<Module Name="KnowledgeBasePages" Url="" Path="KnowledgeBaseFolder">
<File Url="KnowledgeBases.aspx">
<View List="KnowledgeBaseList" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="0" />
</File>
<File Url="KnowledgeBaseLink.aspx"/>
</Module>
</Elements>