Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. /*
  2. 1. set master DB as the context database
  3. 2. Give the target template path (use only template specific subpath)
  4. 3. Parent folder path
  5. 4. ($_.TemplateName -eq "Image") - name of the existing template in quotes.
  6. */
  7. $master = [Sitecore.Configuration.Factory]::GetDatabase("master");
  8. $entryTemplate = $master.Templates['System/Media/Unversioned/Image'];
  9. cd master:"\media library\Documents";
  10. Get-ChildItem -recurse | ForEach-Object { if ($_.TemplateName -eq "Image") { $_.ChangeTemplate($entryTemplate) } };
  11.  
  12. ///The following code changes the template of 'Versioned' Pdf files to 'Unversioned' Pdf files.
  13. //$master = [Sitecore.Configuration.Factory]::GetDatabase("master");
  14. //$entryTemplate = $master.Templates['System/Media/Unversioned/Pdf'];
  15. //cd master:"\media library\Documents";
  16. //Get-ChildItem -recurse | ForEach-Object { if ($_.TemplateName -eq "Pdf") { $_.ChangeTemplate($entryTemplate) } };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement