Tag: Powershell

Sitecore: How to import content with minimum effort

Very often (in testing perspective or vital necessity) there is a need to import data into the Sitecore. There are many tools that can be used for such purpose. But I want to propose you something very simple, something readily available, and yet something powerful and flexible enough to build a reusable component. In such a case I would use Sitecore Powershell Extensions.

Continue reading “Sitecore: How to import content with minimum effort”


Sitecore: Search for Items That Don’t Have Any Language Versions Using Powershell

Recently, I have faced with an issue using traditional Powershell commands. I was trying to identify items that did not have any associated language version. There are various ways of how an item can get to this state. I will not get into these cases here, because they are typically specific to the implementation. But, what is certain across all cases is that these items cause problems because they (and their descendants) don’t get published. This causes a lot of confusion between what you see in Experience Editor and on the front-end site – items are not the same.

The problem lies in the format of traditional Powershell commands which are require a -Language param to retrieve specific versions. I specifically needed to identify unversioned items, but it was not so simply:

  • If you leave the language param off, it will use “en” as the default choice
  • If you pass an empty string for this param, it will return all versions of items that have language versions.

That’s great, but I still had not udentifier the items without a language version. If you want to reproduce it, just create a new item, then go to the “Versions” tab and delete the current version.

Here comes the Powershell

Since I could not use Get-ChildItems to get my unversioned items, I had the idea to look for items that have a collective count of all language versions equal to 0. There is a wonderful method  that helps me to achive my goal – GetVersions. It receives at the input bool includeAllLanguages and returns an array of items. This is the perfect method to leverage since I can test for an empty count to determine if it’s one of the unversioned items.

# point this to the root of your website
$folder = "/sitecore/content"

# Where-Object clause could be combined with other filters
# like Name or Template to narrow results for something specific
$items = Get-ChildItem -Path $folder -recurse | `
Where-Object { $_.Versions.GetVersions($true).Count -eq 0 } | `
"ID" = $_.ID
"ItemName" = $_.Name
"Item" = $_
"ItemPath" = $_.Paths.Path

# print out any results that were found

I hope this work around will save you some time and frustration. As I mentioned, being able to identify these items is critical to resolving the conflict between what you are seeing in the Experience Editor and what is showing on the front-end site.


Sitecore Content Editor: Performance Tips

Sitecore Content Editor: Performance Tips

While Sitecore continues to extend Content Editor functionality to the Experience Editor, Content Editor remains the interface of choice for developers and power users. Its performance can significantly impact the productivity of any development team. With the fairly simple adjustments I outline here, you can optimize Sitecore Content Editor performance and usability.

Continue reading “Sitecore Content Editor: Performance Tips”

How to remove Template Language Version

Few days ago I have faced with the situation when some of my templates had had language versions that differs from en.

Firstly I opened Template Manager and navigated to desired template. Then I clicked on Versions tab and was very surprised. There was no button to remove version! There is possibility to save, to switch and to reset, on this tab. Fortunately, Sitecore is a very powerful tool with a lots of different helpful utility pages. One of them saved my life.

Continue reading “How to remove Template Language Version”

Sitecore and Powershell: Jack of all trades

Sitecore and Powershell: Jack of all trades

Several months ago I have been setting up a few scripts so that I can automate the creation / adjustment of new / existing solutions for customers and also make it easy for other developers/front-enders to start working on new projects.

Powershell has been invaluable in setting up these processes and I’ve been amazed on a daily basis just how powerful the language can be. Your everyday mundane tasks such as renaming a group of files, finding and replacing text or even attaching databases can become automated.

Also, I want mention that developer from time to time should do disposable actions to adjust solution and fix some wrong behavior. With the help of Powershell there is no need to prepare some workaround of how to deliver such fixes. You just write Powershell code, test it and then run on LIVE.

That’s why I’m  also a big fan of Adam Najmanowicz’s Sitecore Powershell Extensions!

Continue reading “Sitecore and Powershell: Jack of all trades”