First published on TECHNET on Apr 11, 2018
This post is a contribution from Sohail Sayed, an engineer with the SharePoint Developer Support team
Below is an example
In a working scenario you can see 3 web parts on the welcome page for a Document Set content type as below
It looks like there is an issue due to which the webparts on the welcome page are not provisioned when creating the list from the custom list templates through CSOM. The issue does not happen if we create the list using the custom list template in UI.
Fortunately, there are couple of simple solutions to fix this issue.
The first solution is to remove and re-add the content types of type Document Set in CSOM. This will re-provision the welcome page correctly with the required web parts. However, if the custom list template is saved with content and has list items referencing the Document Set Content types then we will get an error if we try to remove the content types. In this case we can use an alternate solution to add the web parts through code.
The page contains the following 3 web parts
- an Image web part which references a static image from /_layouts folder
- Web part to display document set metadata
- Web Part to display the document set items
All the 3 web parts read the current list item context and we don’t need to explicitly configure any properties like list id or list url.
Below is the sample code for adding the web parts to the welcome page of the document set content types using JSOM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.