We have received request to identify list of Sitecore Items that were modified from certain date, which contains latest numbered versions, which should have all language versions and modified by particular user. After research we came across Out of the Box Sitecore feature which provides some of these information. I have added link below you can go through document for more details.
Above Out of the Box feature does not contains all the information that we required, especially language versions for the items were missing in the reports.
To solve this problem we decided to write custom PowerShell script which will provide the details.
$itemPath = "master:/sitecore/content/home" $fromDate = (get-date "08/01/2021") # mm/dd/yyyy format Get-ChildItem -Path $itemPath -Recurse -Language * | Where-Object { $_.__Updated -gt $fromDate -and $_."__Updated By" -eq "sitecore\Admin" } | Select-Object -Property @{Label="Display Name"; Expression={$_."DisplayName"} }, @{Label="ID"; Expression={$_."Id"} }, @{Label="Item Path"; Expression={$_."itemPath"} }, @{Label="Language Version"; Expression={$_."Language"} }, @{Label="Numbered Version"; Expression={$_."Version"} }, @{Label="Created Date"; Expression={$_."Created"} }, @{Label="Updated Date"; Expression={$_."__Updated"} }, @{Label="Template Name"; Expression={$_."TemplateName"} }, @{Label="Template ID"; Expression={$_."TemplateID"} }, @{Label="Created By"; Expression={$_."__Created By"} }, @{Label="Updated By"; Expression={$_."__Updated By"} }
Console Output
Above script will provide details of items staring from particular date, which will contain latest numbered version, all created language version and item modified by particular user.
Details displayed for items are as follows:
- Display Name
- ID
- Item Path
- Language Version
- Numbered Version
- Created Date
- Updated Date
- Template Name
- Template ID
- Created By
- Updated By
Also you can modify above script as per your requirement and reuse the script.
If you want to export the content in text file you can use below script to perform the task.
$itemPath = "master:/sitecore/content/home" $fromDate = (get-date "08/01/2021") # mm/dd/yyyy format [String[]] $data = Get-ChildItem -Path $itemPath -Recurse -Language * | Where-Object { $_.__Updated -gt $fromDate -and $_."__Updated By" -eq "sitecore\Admin" } | Select-Object -Property @{Label="Display Name"; Expression={$_."DisplayName"} }, @{Label="ID"; Expression={$_."Id"} }, @{Label="Item Path"; Expression={$_."itemPath"} }, @{Label="Language Version"; Expression={$_."Language"} }, @{Label="Numbered Version"; Expression={$_."Version"} }, @{Label="Created Date"; Expression={$_."Created"} }, @{Label="Updated Date"; Expression={$_."__Updated"} }, @{Label="Template Name"; Expression={$_."TemplateName"} }, @{Label="Template ID"; Expression={$_."TemplateID"} }, @{Label="Created By"; Expression={$_."__Created By"} }, @{Label="Updated By"; Expression={$_."__Updated By"} } Out-Download -Name ItemDetailsReport.txt -InputObject $data
ItemDetailsReport.txt File
Also refer below articles if you want to create Sitecore PowerShell Reports inside PowerShell module in Sitecore CMS
Hope you find this information useful.😄
No comments:
Post a Comment