how can I get path property of Sitecore item using PowerShell module?
4 Answers
You can get item properties using this command.
$itemID = "{8A87AC2B-210D-49F2-93FC-215918085418}" #Mention your Item ID
# Use Format-Table if you want to show results in the table view.
Get-Item -Path "master:" -ID "$itemID" | Format-Table -Property ID, Name, DisplayName, "Page Title", @{Label="Path"; Expression={$_.Paths.FullPath} }
# Use Show-ListView if you want to show result in a popup window
Get-Item -Path "master:" -ID "$itemID" | Show-ListView -Property ID, Name, DisplayName, "Page Title", @{Label="Path"; Expression={$_.Paths.FullPath} }
The window will also give you the option to export. Like this.
Read this article for more operations.
You can get the path of Sitecore item through Powershell Script:-
Get-Item -Path "master:/sitecore/content/Home" | Show-ListView -Property `
@{Label="ID"; Expression={$_.ID}},
@{Label="Name"; Expression={$_.DisplayName}},
@{Label="Path"; Expression={$_.Paths.Path}}
Update the path of Sitecore item "master:/sitecore/content/Home"
. To get the path of item, Click on the item in Sitecore Content tree and have a look at the Quick info tab and copy the Item path
.
If you have the item as a variable and just want the Sitecore path, it is simple:
$item.Paths.Path
$item = Get-Item master:/content/home
Write-Host "Item path: " $item.FullPath
It will give following output
Item path: /sitecore/content/Home
We can get item by Id and access all item property like this.
$item = Get-Item -Path master: -ID {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}
Write-Host $item.Paths.Path
We can get more example here: https://gist.github.com/Adamsimsy/30dc60df837c1400e6fccd814b3dc752