PnP js create view

Iron Contributor

Hello,

 

I am trying to use PnP-js-core and REST to provision libraries on SharePoint Online.

 

What I have working so far:

- create the library

- add a content type

 

The next step is to add a view using PnP:

myLibrary.views.add('Last Modified', false, {
ListViewXml: '<View MobileView="TRUE" Type="HTML" Scope="Recursive" DisplayName="Last Modified" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=44" ><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE" /></OrderBy></Query><ViewFields><FieldRef Name="DocIcon" /><FieldRef Name="LinkFilename" /><FieldRef Name="Modified" /><FieldRef Name="Editor" /><FieldRef Name="Author" /></ViewFields><RowLimit Paged="TRUE">300</RowLimit><Aggregations Value="Off" /><JSLink>clienttemplates.js</JSLink><XslLink Default="TRUE">main.xsl</XslLink><Toolbar Type="Standard"/></View>'
});

 The view gets created but custom settings (sorting, display fields) are not applied. The new view looks just like the "All Documents" view.

 

What am I missing?

0 Replies