Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
Office 365 - SharePoint Online - Provisioning a Publishing page with the List View - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2013-11-26

In Office 365 / SharePoint online,  a publishing page with a list of views pointing to a different list can be provisioned using a feature containing a File element containing a view.

Example:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ModuleName" Url="$Resources:cmscore,List_Pages_UrlName;">
<File Url="default.aspx" Type="GhostableInLibrary" Path="ModuleName\default.aspx" IgnoreIfAlreadyExists="TRUE" >
<Property Name="Title" Value="Home" />
<Property Name="IncludeInGlobalNavigation" Value="FALSE" />
<Property Name="ContentType" Value="ContentTypeName" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PageLayout.aspx, PageLayout" />
<View List="Lists/MyTasks" BaseViewID="0" WebPartZoneID="Main" WebPartOrder="1">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="AllowConnect" type="bool">True</property>
<property name="ChromeType" type="chrometype">TitleAndBorder</property>
<property name="AllowClose" type="bool">False</property>
<property name="Title" type="string">Tasks</property>
</properties>
</data>
</webPart>
</webParts>
]]>
</View>
</File>
</Module>
</Elements>

Note:

<View List="Lists/MyTasks" BaseViewID="0" ....></View> - represents a view in a List "MyTasks". This can be changed to a different view.
The above can also be achieved using the AllUsersWebPart by initialising all the relevant properties.
<AllUsersWebPart WebPartZoneID="wzMain" WebPartOrder="2">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="ShowWithSampleData" type="bool">False</property>
<property name="Default" type="string" />
<property name="NoDefaultStyle" type="string" null="true" />
<property name="CacheXslStorage" type="bool">True</property>
<property name="ViewContentTypeId" type="string" />
<property name="XmlDefinitionLink" type="string" />
<property name="ManualRefresh" type="bool">False</property>
<property name="ListUrl" type="string" >Lists/Tasks</property>
<property name="TitleUrl" type="string">/Lists/Tasks</property>
...
</properties>
</data>
</webPart>
</webParts>
]]>
</AllUsersWebPart>

 
<!–[CDATA[

Cannot import this Web Part.

False

True

False
Lists/Tasks
/Lists/Tasks

]]>

(Visited 101 times, 1 visits today)

About the author 

Balamurugan Kailasam

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.