Modules

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Modules are defined in an element manifest similarly to how they are defined in an Onet.xml file to specify files with which to provision SharePoint sites.

Zero or more File elements are allowed as a child of the Module element. Use the AllUsersWebPart element to specify a web part instance inside a given page except for a list view web part. The View element specifies list view web parts to use on site pages. The NavBarPage element declares that the page containing this element should participate in the navigation bar structure. The Property element allows you to specify custom properties for a Feature.

An element manifest uses the following schema:


The following schema is used within an Onet.xml file:

Examples

The following example registers a web part Feature that specifies custom properties.

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://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>

The next example registers a Feature that includes two files and that specifies a list view to display on one of the pages.

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://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>

See also