2

While trying to create a report compatible with the SPE Data Importer, I noticed that the date is formatted rather than the raw value.

How do I change this script to give me the date in the proper format?

$templateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"
Get-Item -Path master: -Query "/sitecore/content/Home//*[@@templateid='$($templateId)']"  | 
    Show-ListView -Property ID, Name, __Created, FullPath

Sample Report

2

SPE adds properties to items returned by Get-Item and Get-ChildItem.

This $item.Fields["Title"].Value becomes this $item.Title.

Since we want the raw version of the field, we will need to populate the report using the raw field.

$templateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"
Get-Item -Path master: -Query "/sitecore/content/Home//*[@@templateid='$($templateId)']"  | 
    Show-ListView -Property ID,Name, @{name="__Created";expression={$_.Fields["__Created"]}},FullPath

Fixed

Note: Incase you were curious, the datetime properties are formatted with the command [Sitecore.DateUtil]::IsoDateToDateTime().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.