Skip to content

Instantly share code, notes, and snippets.

@AdamNaj
Created November 10, 2018 14:19
Show Gist options
  • Save AdamNaj/eca5d3df0f37147805dc010711eb7dc3 to your computer and use it in GitHub Desktop.
Save AdamNaj/eca5d3df0f37147805dc010711eb7dc3 to your computer and use it in GitHub Desktop.
Querying Habitat Legal Site for Tags
gci -path 'master:\content\Habitat sites\Habitat Legal\Home\News' |
%{ [PSCustomObject]@{ Name=&{$_.Title};
Author=&{@( $_.PSFields.Author.Items |
%{ gi master: -id $_ } |
%{ "$($_._Name) ($($_.JobTitle))" }) -join ", "};
Tags=&{@( $_.PSFields.SxaTags.Items |
%{ gi master: -id $_ } |
%{ $_.Name }) -join ", "}
} } | ft -prop @{name="Name"; width=50; Expression={$_.Name}},
@{name="Author"; width=60; Expression={$_.Author}}, Tags
gci -path 'master:\content\Habitat sites\Habitat Legal\Home\our-team' |
%{ [PSCustomObject]@{ Name=&{$_._Name}; JobTitle=&{$_.JobTitle};
Tags=&{@( $_.PSFields.SxaTags.Items |
%{ gi master: -id $_ } |
%{ $_.Name }) -join ", "};
Author=&{@( $_.PSFields.Author.Items |
%{ gi master: -id $_ } |
%{ $_.Name }) -join ", "}
} } | ft #-auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment