SOLVED
Home

Specify view for XsltListViewWebPart using PnP Provisioning Engine

Johannes Ekstrand
New Contributor

Specify view for XsltListViewWebPart using PnP Provisioning Engine

I wonder if it is possible to specify what list view should be used when adding an XsltLitViewWebPart to a page with the PnP Provisioning Engine?

4 Replies
Solution

RE: Specify view for XsltListViewWebPart using PnP Provisioning Engine

Yes it is using a extensibility provider in your template see: https://docs.com/paul-keijzers/4594/unable-to-change-view-of-list-view-web-part-csom
Highlighted

Re: Specify view for XsltListViewWebPart using PnP Provisioning Engine

Hi,

It's directly supported in PnP via https://github.com/SharePoint/PnP-Sites-Core/issues/584

 

In your webpart xml add one of the following params:

 

  • ViewId (guid of view)
  • ViewGuid (guid of view)
  • ViewName (display name of view)
  • ViewUrl (server relative url of view) 

In my case I have a list view named "Recently modified documents", and added this to the webpart properties xml in my provisining template.

 

<property name="ViewName" type="string">Recently modified documents</property>

 

PnP then fixes the hidden view automatically for you.

Re: Specify view for XsltListViewWebPart using PnP Provisioning Engine

Awesome! That really worked, thanks for putting light on this. Wasn't able to see that when going through the PnP source code! Have now replaced my custom extention handler with this!

Re: Specify view for XsltListViewWebPart using PnP Provisioning Engine

Awesome, and feel free to change my answer to "best response" ;-)

Related Conversations
Videos not registering views
Aidan MacDonald  in  Microsoft Stream Forum  on
4 Replies
custom Branding in SharePoint modern view
sagar savaliya  in  SharePoint  on
6 Replies
Modern Site Page People Web Part
Catherine Billick  in  SharePoint  on
32 Replies