6

I want to export all fields of all items to excel for all items under a node or all items based on a specific template, I don't mind which.

I had a look at the answer to this question on SO: https://stackoverflow.com/questions/6610423/export-list-of-sitecore-items-as-excel-or-other-formats

The Advanced System Reporter module from the question above seems really good, although the default viewer only exports general item information and no fields specific to to the template. Is it possible to export all items and all fields with this module natively or do I need to create a custom viewer for this?

5

The ASR module has been great and inspired other modules. You may find that Sitecore PowerShell Extensions is an excellent alternative since it allows you to virtually script any report you need.

Check out the documentation here.

Example: The following determines all the fields that belong to the item, excluding the Standard Fields. The final report can be exported from the top ribbon.

# Create a list of field names on the Standard Template. This will help us filter out extraneous fields.
$standardTemplate = Get-Item -Path "master:" -ID "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"
$standardTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$standardTemplate
$standardFields = $standardTemplateTemplateItem.OwnFields + $standardTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique

# Change the Id to something other than the Sample Item template.
$itemTemplate = Get-Item -Path "master:" -ID "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"
$itemTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$itemTemplate
$itemTemplateFields = $itemTemplateTemplateItem.OwnFields + $itemTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique

$filterFields = $itemTemplateFields | Where-Object { $standardFields -notcontains $_ } | Sort-Object

$path = "master:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
@(Get-Item -Path $path) + @(Get-ChildItem -Path $path -Recurse) | Show-ListView -prop $filterfields

Report Results

  • 1
    This is an excellent alternative although I'll accept my answer, only because I found a way to solve my problem using the approach I was taking. – Calum Oct 12 '17 at 18:30
2

I found a way of being able to do this natively, without writing any code, using Advanced System Reporter. After having a look at the code on GitHub I realised I could copy the ItemViewer viewer then edit the raw value of the viewer field adding my custom field to the list of standard fields:

<Columns>
    <Column name="name">Name</Column>
    <Column name="owner">Owner</Column>
    <Column name="createdby">Created By</Column>
    <Column name="created">Created</Column>
    <Column name="updatedby">Updated By</Column>
    <Column name="updated">Updated</Column>
    <Column name="path">Path</Column>
    <Column name="Custom Field">Custom Field</Column>
</Columns>

It was necessary to edit the raw value as the Columns type is populated from code.

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.