2

I am using SharePoint 2013 on premises to build an application which utilizes a Document Set Content Type. I have used the GUI to:

  1. Create Site Columns for the website;
  2. Create a Document Set Content Type for the website;
  3. Assign those Site Columns to the Document Set Content Type ("add from existing site columns");
  4. Assign Default Content to the Document Set Content Type in the form of folders and files (see image); and
  5. Added the resulting Document Set Content Type to a Document Library (Library Settings, "Add from existing site content types").

The resulting Document Library works just fine, but a site template of the website does not re-create my Document Set Content Type, no doubt because of some error in the many steps and clicks required by the GUI approach.

SharePoint 2013 on-premises GUI: Document Set Settings, Default Content

The folder and file structure contained by an instance of our Document Set Content Type includes several levels of subfolders for a total of about thirty entities (folders and files).

To accelerate development and trouble-shooting, I have successfully written and tested a PowerShell script to duplicate all of those steps, except number 4. I have no idea how to do it. The examples I have seen of creating folders and files in a Document Set Content Type all speak to adding default content to a Document Set after it is in a List. My requirements are that the Document Set Content Type and its default content exist prior to the Content Type being added to a Document Library, just as it is done in the GUI.

What SharePoint objects, methods, and properties will achieve the same result that the GUI achieves with respect to step 4?

0

This was answered in TechNet. Essentially, the answer is: Use the DocumentSetTemplate.DefaultDocuments.Add() method to add default documents to the Document Set content type. The DocumentSetTemplate class is found in the Microsoft.Office.DocumentManagement.DocumentSets namespace.

  • This is a poor answer. Original request asks for PowerShell, not C#. – Nullldata Aug 3 '18 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.