xpath - Append Base Template to Template using Sitecore Powershell -


i'm new sitecore powershell (and powershell in general), , generate script adds template base template list of childitem templates under context folder.

since __base template standard value , not regular field, i'm not sure if there syntax available append guid multilist field uses (pipe delimited).

here's i've tried

$master = get-database master; $translationtemplate = $master.templates["path/to/template/needed/translatable"]; $callouttemplate = $master.templates["path/to/example/callout"];  #$translationtemplate;  $callouttemplate += $translationtemplate; 

i'm able of children recursively get-childitem -recursive, test run, want try on 1 template item called callout. here's view of $callouttemplate, showing has basetemplates section , fields section (which should include __base template):

enter image description here

if there no solution in powershell sitecore, sitecore rocks query analyser crud operations possibly work?

basically script you're looking is:

$templatetoextend = get-item 'master:/templates/path/to/example/callout' $templatetoadd= get-item 'master:/templates/path/to/template/needed/translatable'  # make sure we're not adding again if it's there if(-not ($templatetoextend."__base template" -match "$($templatetoadd.id)")) {     "adding '$($templatetoadd.name)' '$($templatetoextend.name)' base templates"     $templatetoextend."__base template" = "$($templatetoextend.'__base template')|$($templatetoadd.id)"  }  # verify got added: $templatetoextend."__base template" 

however doesn't give powershell justice. power of can turn snippet function can piped into. can following michael's tutorial on blog


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -