Posts

Showing posts from July, 2024

Challenges in getting Sitecore item which has hyphen or dash(-) in the name

Image
Let's imagine a scenario where we want to extract all the item details from a Sitecore based on the list of page URLs provided in the CSV file. The Url format in the CSV file: https://{domainname}/{language}/{path-with hypen} So we can think of using Powershell Get-Item to get all the details of URLs from the given CSV file. we expected that all would go smoothly, but when we saw the result most of the URLs got failed by throwing  the item was not found exception  in the PowerShell, we thought that the issue was because of the URL provided in the CSV which has a hyphen in it( replaced all the spaces in the item name with a hyphen ), it is because of the following settings. < encodeNameReplacements >     < replace mode = "on" find = "&amp;" replaceWith = ",-a-," />     < replace mode = "on" find = "?" replaceWith = ",-q-," />     < replace mode = "on" find = "/" replac