Posts

Showing posts from November, 2022

Organize media files using Sitecore PowerShell

Image
Sometimes you work on project that contains big modules like "News & Media" and it contains many Media Files,   organizing Items easy using Buckets, but what about the Media files?! In this Blog Post I will provide you with a script that help you to generate media folders from 0-9 & a-z i.e. Dependencies: Sitecore powerShell The Script: The below script will help you generate Alpha Numeric Folders and move the files under those folders $alphaNumeric=@() 65..90|foreach-object{$alphaNumeric+=[char]$_} # Add the characters A-Z to the Array 48..57|foreach-object{$alphaNumeric+=[char]$_} # Add the characters 0-9 to the Array # The folder in which you want to organize the media $root = "master:/sitecore/media library/{your path}" # Generate folders based on the alpha numeric array foreach ($item in $alphaNumeric) { # Skip if the folder already ...

Set workflow for project templates using PowerShell

Image
Sitecore PowerShell is very powerful tool that helps in many kinds of tasks especially the repetitive tasks, in this blog I am sharing with you a small script that helps to add workflow to all Project templates $allItems = Get-ChildItem -path "/sitecore/templates/Project/{Your Project}" -Recurse  foreach($item in $allItems){     if($null -ne $item["__Default workflow"] -and $item.Name -eq "__Standard Values"){             Write-Host $item.Paths.FullPath             $item.Editing.BeginEdit()             $item["__Workflow"]=""             $item["__Default workflow"]="{Your Workflow ID}"             $item.Editing.EndEdit()     } }