0
votes

Problem Statement- Assume predefined base templates and rendering are in place.

Want to create new template item using SPE.

  1. Create Template Item using Template .
  2. Update base template field using Raw values. {Template Item GUID}|{Template Item GUID} Create Standard Values.
  3. Add standard Layout rendering as raw values in standard , which is again available, just need to assign.
  4. Add insert options.

Any guidance to go about this using SPE.

1

1 Answers

3
votes

To create a template item with Standard Values in Sitecore with Sitecore PowerShell Extensions (SPE). You can use some things like this:

cd master:\
$item = New-Item  -Path "/sitecore/templates/User Defined" -Name "testtemplate" -type "{AB86861A-6030-46C5-B394-E8F99E8B87DB}"
$standardvalues = New-Item -Parent $item -Name "__Standard Values" -type $item.ID
$item.Editing.BeginEdit()
$item["__Standard values"] = $standardvalues.ID
$item.Editing.EndEdit()

I suspect that the insert options can add the same as the __Standard Values just edit the Insert options field. See also Set-Layout and Add-Rendering for adding renderings.