Issue provisioning SharePoint site with PnP - calendar webpart displaying as listview

Copper Contributor

Hi,

 

I am having an issue with the PnP provisioning of a on premise SharePoint 2013 site from an XML template.  The site provisions correctly but the calendar web part displays as a list view.

 

Template SiteTemplate SiteProvisioned SiteProvisioned Site

 

Though if you edit the provisioned page you can apply the calendar view successfully, though this is not an option as we are looking to provision a large amount of sites.

 

The steps involved where:

 

1) Export XML template with Get-PnPProvisioningTemplate

2) Create sites 

3) Console application runs picks up sites and apply provisioned template

 

The web part template XML is:

<pnp:WebPart Order="1" Title="Calendar" Zone="Zone3">
        <pnp:Contents>
          <WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">
            <Title>Calendar</Title>
            <FrameType>Default</FrameType>
            <Description />
            <IsIncluded>true</IsIncluded>
            <ZoneID>Zone3</ZoneID>
            <PartOrder>2</PartOrder>
            <FrameState>Normal</FrameState>
            <Height />
            <Width />
            <AllowRemove>true</AllowRemove>
            <AllowZoneChange>true</AllowZoneChange>
            <AllowMinimize>true</AllowMinimize>
            <AllowConnect>true</AllowConnect>
            <AllowEdit>true</AllowEdit>
            <AllowHide>true</AllowHide>
            <IsVisible>true</IsVisible>
            <DetailLink>{site}/Lists/Calendar</DetailLink>
            <HelpLink />
            <HelpMode>Modeless</HelpMode>
            <Dir>Default</Dir>
            <PartImageSmall />
            <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
            <PartImageLarge>/_layouts/15/images/itevent.png?rev=23</PartImageLarge>
            <IsIncludedFilter />
            <Assembly>Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
            <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
            <WebId xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">00000000-0000-0000-0000-000000000000</WebId>
            <ListViewXml xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">&lt;View Name="{EC801658-ACB6-4802-9F7A-F3876E594CE2}" MobileView="TRUE" Type="CALENDAR" Hidden="TRUE" TabularView="FALSE" RecurrenceRowset="TRUE" DisplayName="" Url="{site}/Pages/Home.aspx" Level="1" BaseViewID="2" ContentTypeID="0x" MobileUrl="_layouts/15/mobile/viewdaily.aspx" ImageUrl="/_layouts/15/images/events.png?rev=44"&gt;&lt;Toolbar Type="Standard" /&gt;&lt;ViewHeader /&gt;&lt;ViewBody /&gt;&lt;ViewFooter /&gt;&lt;ViewEmpty /&gt;&lt;ParameterBindings&gt;&lt;ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /&gt;&lt;ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /&gt;&lt;/ParameterBindings&gt;&lt;ViewFields&gt;&lt;FieldRef Name="EventDate" /&gt;&lt;FieldRef Name="EndDate" /&gt;&lt;FieldRef Name="fRecurrence" /&gt;&lt;FieldRef Name="EventType" /&gt;&lt;FieldRef Name="WorkspaceLink" /&gt;&lt;FieldRef Name="Title" /&gt;&lt;FieldRef Name="Location" /&gt;&lt;FieldRef Name="Description" /&gt;&lt;FieldRef Name="Workspace" /&gt;&lt;FieldRef Name="MasterSeriesItemID" /&gt;&lt;FieldRef Name="fAllDayEvent" /&gt;&lt;/ViewFields&gt;&lt;ViewData&gt;&lt;FieldRef Name="Title" Type="CalendarMonthTitle" /&gt;&lt;FieldRef Name="Title" Type="CalendarWeekTitle" /&gt;&lt;FieldRef Name="Location" Type="CalendarWeekLocation" /&gt;&lt;FieldRef Name="Title" Type="CalendarDayTitle" /&gt;&lt;FieldRef Name="Location" Type="CalendarDayLocation" /&gt;&lt;/ViewData&gt;&lt;Query&gt;&lt;Where&gt;&lt;DateRangesOverlap&gt;&lt;FieldRef Name="EventDate" /&gt;&lt;FieldRef Name="EndDate" /&gt;&lt;FieldRef Name="RecurrenceID" /&gt;&lt;Value Type="DateTime"&gt;&lt;Month /&gt;&lt;/Value&gt;&lt;/DateRangesOverlap&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;</ListViewXml>
            <ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">{{listid:Calendar}}</ListName>
            <ListId xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">{listid:Calendar}</ListId>
            <ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">8921097</ViewFlag>
            <ViewFlags xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">Html Hidden RecurrenceRowset Calendar Mobile</ViewFlags>
            <ViewContentTypeId xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">0x</ViewContentTypeId>
          </WebPart>
        </pnp:Contents>
			</pnp:WebPart>

And the list view XML is (where BaseViewId=2 defined as teh correct calendar view):

<pnp:ListInstance Title="Calendar" Description="" DocumentTemplate="" TemplateType="106" Url="Lists/Calendar" EnableModeration="true" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="2" TemplateFeatureID="00bfea71-ec85-4903-972d-ebe475780106" ContentTypesEnabled="true" EnableFolderCreation="false">
          <pnp:ContentTypeBindings>
            <pnp:ContentTypeBinding ContentTypeID="0x0102" Default="true" />
          </pnp:ContentTypeBindings>
          <pnp:Views>
            <View Name="{0EA1957C-4807-44F8-9976-2A2F65C7AFB8}" MobileView="TRUE" Type="HTML" DisplayName="All Events" Url="{site}/Lists/Calendar/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/events.png?rev=23">
              <Query>
                <OrderBy>
                  <FieldRef Name="EventDate" />
                </OrderBy>
              </Query>
              <ViewFields>
                <FieldRef Name="fRecurrence" />
                <FieldRef Name="WorkspaceLink" />
                <FieldRef Name="LinkTitle" />
                <FieldRef Name="Location" />
                <FieldRef Name="EventDate" />
                <FieldRef Name="EndDate" />
                <FieldRef Name="fAllDayEvent" />
              </ViewFields>
              <RowLimit Paged="TRUE">30</RowLimit>
              <JSLink>clienttemplates.js</JSLink>
            </View>
            <View Name="{CE01A2DE-76BA-4655-9377-F6226DD1B2B4}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="CALENDAR" TabularView="FALSE" RecurrenceRowset="TRUE" DisplayName="Calendar" Url="{site}/Lists/Calendar/calendar.aspx" Level="1" BaseViewID="2" ContentTypeID="0x" MobileUrl="_layouts/15/mobile/viewdaily.aspx" ImageUrl="/_layouts/15/images/events.png?rev=23">
              <Query>
                <Where>
                  <DateRangesOverlap>
                    <FieldRef Name="EventDate" />
                    <FieldRef Name="EndDate" />
                    <FieldRef Name="RecurrenceID" />
                    <Value Type="DateTime">
                      <Month />
                    </Value>
                  </DateRangesOverlap>
                </Where>
              </Query>
              <ViewFields>
                <FieldRef Name="EventDate" />
                <FieldRef Name="EndDate" />
                <FieldRef Name="fRecurrence" />
                <FieldRef Name="EventType" />
                <FieldRef Name="WorkspaceLink" />
                <FieldRef Name="Title" />
                <FieldRef Name="Location" />
                <FieldRef Name="Description" />
                <FieldRef Name="Workspace" />
                <FieldRef Name="MasterSeriesItemID" />
                <FieldRef Name="fAllDayEvent" />
                <FieldRef Name="_ModerationStatus" />
              </ViewFields>
            </View>
            <View Name="{7A19B13D-8C3D-4D69-BE8A-5C3631196535}" MobileView="TRUE" Type="HTML" RecurrenceRowset="TRUE" DisplayName="Current Events" Url="{site}/Lists/Calendar/MyItems.aspx" Level="1" BaseViewID="3" ContentTypeID="0x" ImageUrl="/_layouts/15/images/events.png?rev=23">
              <Query>
                <Where>
                  <DateRangesOverlap>
                    <FieldRef Name="EventDate" />
                    <FieldRef Name="EndDate" />
                    <FieldRef Name="RecurrenceID" />
                    <Value Type="DateTime">
                      <Now />
                    </Value>
                  </DateRangesOverlap>
                </Where>
                <OrderBy>
                  <FieldRef Name="EventDate" />
                </OrderBy>
              </Query>
              <ViewFields>
                <FieldRef Name="fRecurrence" />
                <FieldRef Name="WorkspaceLink" />
                <FieldRef Name="LinkTitle" />
                <FieldRef Name="Location" />
                <FieldRef Name="EventDate" />
                <FieldRef Name="EndDate" />
                <FieldRef Name="fAllDayEvent" />
              </ViewFields>
              <JSLink>clienttemplates.js</JSLink>
            </View>
            <View Name="{82BB8B2F-3AC9-442C-8576-68F26BEC0DBC}" Type="HTML" TabularView="FALSE" ModerationType="Contributor" DisplayName="My submissions" Url="{site}/Lists/Calendar/my-sub.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/events.png?rev=23">
              <Query>
                <GroupBy>
                  <FieldRef Name="_ModerationStatus" Ascending="FALSE" />
                </GroupBy>
              </Query>
              <ViewFields>
                <FieldRef Name="DocIcon" />
                <FieldRef Name="LinkTitle" />
                <FieldRef Name="Modified" />
                <FieldRef Name="Editor" />
                <FieldRef Name="_ModerationStatus" />
                <FieldRef Name="_ModerationComments" />
              </ViewFields>
              <RowLimit Paged="TRUE">30</RowLimit>
              <JSLink>clienttemplates.js</JSLink>
            </View>
            <View Name="{88E51BCC-C115-4DB2-948C-A9DE9050AD37}" Type="HTML" TabularView="FALSE" ModerationType="Moderator" DisplayName="Approve/reject Items" Url="{site}/Lists/Calendar/mod-view.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/events.png?rev=23">
              <Query>
                <GroupBy>
                  <FieldRef Name="_ModerationStatus" Ascending="FALSE" />
                </GroupBy>
              </Query>
              <ViewFields>
                <FieldRef Name="DocIcon" />
                <FieldRef Name="LinkTitle" />
                <FieldRef Name="Modified" />
                <FieldRef Name="Author" />
                <FieldRef Name="Editor" />
                <FieldRef Name="_ModerationStatus" />
                <FieldRef Name="_ModerationComments" />
              </ViewFields>
              <RowLimit Paged="TRUE">30</RowLimit>
              <JSLink>clienttemplates.js</JSLink>
            </View>
          </pnp:Views>
          <pnp:FieldRefs>
            <pnp:FieldRef ID="288f5f32-8462-4175-8f09-dd7ba29359a9" Name="Location" DisplayName="Location" />
            <pnp:FieldRef ID="64cd368d-2f95-4bfc-a1f9-8d4324ecb007" Name="EventDate" Required="true" DisplayName="Start Time" />
            <pnp:FieldRef ID="2684f9f2-54be-429f-ba06-76754fc056bf" Name="EndDate" Required="true" DisplayName="End Time" />
            <pnp:FieldRef ID="9da97a8a-1da5-4a77-98d3-4bc10456e700" Name="Description" DisplayName="Description" />
            <pnp:FieldRef ID="7d95d1f4-f5fd-4a70-90cd-b35abc9b5bc8" Name="fAllDayEvent" DisplayName="All Day Event" />
            <pnp:FieldRef ID="f2e63656-135e-4f1c-8fc2-ccbe74071901" Name="fRecurrence" DisplayName="Recurrence" />
            <pnp:FieldRef ID="8137f7ad-9170-4c1d-a17b-4ca7f557bc88" Name="ParticipantsPicker" DisplayName="Attendees" />
            <pnp:FieldRef ID="6df9bd52-550e-4a30-bc31-a4366832a87d" Name="Category" DisplayName="Category" />
          </pnp:FieldRefs>
          <pnp:FieldDefaults>
            <pnp:FieldDefault FieldName="Category" />
          </pnp:FieldDefaults>
        </pnp:ListInstance>

 Thanks

 

Amy

 

3 Replies

i guess it is on a normal page where you put the webpart it default shows the standaard default view if you want to change you have to change the hidden view.

https://sharepoint-specialist.nu/unable-to-change-view-of-list-view-web-part-csom-solution-office365...

Hi

Unfortunately this still yields the same result

Thanks
Amy

Hi Amy,

Did you ever figure this out?