Created
July 11, 2018 11:42
-
-
Save hishaamn/08197d5a2f8331756fc7216888845cc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import-Function -Name CleanQueryPath | |
| $paths = @("/sitecore/content/My Site/Site 1/home=en-GB") | |
| foreach($path in $paths){ | |
| $results = @(); | |
| $splitter = $path -split "=" | |
| $editorials = Get-Item -Path master: -Query "$(CleanQueryPath -Path $splitter[0])//*[@@templateid='{5963CF27-6FC4-4C70-96E5-3BA55136E23C}' or @@templateid='{90F7233C-341D-4359-8CD6-D9ADF8A18BE4}']" -Language $splitter[1] | |
| if($editorials -ne $null){ | |
| $fileName = "Profile Cards For " + $splitter[1] | |
| $outputFilePath = $AppPath + "\" + $fileName + ".csv" | |
| foreach($editorial in $editorials){ | |
| $tracker = New-Object Sitecore.Analytics.Data.TrackingField($editorial.Fields["__tracking"]); | |
| $profiles = $tracker.Profiles | |
| $profileName = "" | |
| foreach ($profile in $profiles) | |
| { | |
| foreach($v in $profile.Presets.Keys){ | |
| $profileName += "$v|" | |
| } | |
| } | |
| $properties = @{ | |
| ID = $editorial.ID | |
| Name = $editorial.Name | |
| Profile = $profileName | |
| } | |
| $results += New-Object psobject -Property $properties | |
| } | |
| $Results | Select-Object ID,Name,Profile | Export-Csv -notypeinformation -Path $outputFilePath | |
| Send-File -Path $outputFilePath | |
| } | |
| } | |
| "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment