Get All items based on specific template under bucket folder which got updated x days ago.

Scenario: Let assume that due to some wrong migration from external system lot of item fields got updated under Sitecore bucket folder. If we need to fix this kind of scenario we can use the Powershell scripting.

$allItems = Get-ChildItem “master:/sitecore/content/products” -recurse | where-object {$_.TemplateID -eq “{70E9D00C-2A10-41EE-BE6D-8441FD4C8C79}” -and $_.__Updated -gt [datetime]::Now.AddDays(-10) }

How to update one of the Fields.

foreach($item in $allItems){

write-host $item.ID “;” $item.Name
$item.Editing.BeginEdit()
$item.Fields[“FieldtoUpdate”].Value = “CorrectValue”
$item.Editing.EndEdit()

}

4 Replies to “Get All items based on specific template under bucket folder which got updated x days ago.”

  1. Nice read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch!

  2. It is actually a nice and useful piece of information. I抦 happy that you simply shared this helpful information with us. Please keep us up to date like this. Thank you for sharing.

  3. A powerful share, I just given this onto a colleague who was doing somewhat evaluation on this. And he in truth purchased me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying extra on this topic. If potential, as you develop into expertise, would you thoughts updating your weblog with extra particulars? It’s highly helpful for me. Big thumb up for this blog post!

Comments are closed.