Our editors would like to be able to see all locked items at a glance to be able to clean up locks.

There is of course the option to show locked items in the Quick Action Bar in the content tree, but it doesn't show if any descendents are locked, only items currently showing so this doesn't really help.

Is there something out of the box or do we need to use Sitecore Powershell Extensions or something else?

up vote 21 down vote accepted

Sitecore Powershell Extensions is always the answer. There is a standard report available. More info here.

But just in case you might want to try something else:

  1. Sitecore query : /sitecore//*[@__lock!='' and @__lock!='<r />'] This could take a while though..
  2. Index query: (lock:true AND _latestversion:true) You could skip the latest version here if you want it for all versions..

Credits to Dan Sinclair.

  • In the Sitecore query version, could @__lock ever be null? Is it worth including @__lock!=null in the query? – GoetzOnline Oct 11 '16 at 10:48
  • A null check wouldn't add relevance to the query, it's not needed. Can you even do that in a query? (never did it myself, but I also can't remember the last time I actually used a Sitecore query...) – Gatogordo Oct 11 '16 at 11:01
  • You can use SPE to run Sitecore queries. Check out the -Query parameter on Get-Item. – Michael West Oct 11 '16 at 15:23

If the users just want to see their own locked items then they can see a list of all the items and unlock them all via the My Items options in the Ribbon:

My Items

Locked Items List

You can use powershell to achieve this:

gci master:\content -rec | where { $_.Locking.IsLocked() } | 
    select Name, Id, @{n="IsLocked";e={$_.Locking.IsLocked()}}

The following aliases or shortened commands were used:

gci = Get-ChildItem
where = Where-Object
select = Select-Object

More info at http://michaellwest.blogspot.com/2013/09/SPE-UnlockItems.html

Or, using XPath

/sitecore//*[@__lock!='' and @__lock!='<r />']

Note that it is not recommended to run XPATH on Live site since it may cause performance issue if you have too many items.

More info at https://blog.horizontalintegration.com/2016/09/08/sitecore-query-xpath-for-finding-all-locked-items/

I've installed the Advanced System Reporter module in the past, and the content team really enjoyed some of the reports that could be created. Viewing locked items is one, but the tool is pretty granular so it can give a bunch of different insights.

  • This module looks really useful, thanks for sharing! – adragomanov Oct 15 '16 at 9:52

Instead of getting Content Editors to do this you could look at an solution to Auto-unlock items.

We've implemented a solution for this as a Sitecore Tasks as described by Mike Reynolds here:

https://sitecorejunkie.com/2013/09/28/periodically-unlock-items-of-idle-users-in-sitecore/

We've got it set in config to run every 4hrs:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="UnlockItems.ElapsedTimeWhenIdle" value="00:04:00:00" />
    </settings>
  </sitecore>
</configuration> 

This works really well for us and avoid content authors leaving items locked and having to manually unlock them.

--Update--

Another option is to allow users to unlock other users items based on a permission you can assign them. Here are two articles explaining how to go about this:

http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/02/allow-users-to-unlock-items-locked-to-others-in-the-sitecore-aspnet-cms.aspx

https://briancaos.wordpress.com/2010/09/10/unlock-sitecore-items/

We didn't do this but It seems like a nice solution also for trusted content authors.

  • This could also be a solution, depending on why they want the list. – Søren Kruse Oct 11 '16 at 10:58
  • Yeah if thats why they want a list then this may work better. We've had no problems with locked items since we implemented this. As @jammykam has mentioned below though if users want to check items they have locked themselves then they should use the 'My Items' menu option - however this doesn't show items locked by others. Annoying there isn't an 'View All Locked Items' menu option for admins to see them for "all users / specific users". A nice idea for a plugin maybe - with a screen to unlock them all. I've updated my answer above to include some info on another option we considered too. – Adam Seabridge Oct 11 '16 at 11:02
  • @aseabridge I used this a long time ago, I believe it should still work in latest Sitecore: learnsitecore.cmsuniverse.net/en/Developers/Articles/2009/10/… – jammykam Oct 11 '16 at 12:34
  • @jammykam - Nice. So it's a SheerUI implementation of a lock manager for all users. Could come in useful. – Adam Seabridge Oct 11 '16 at 12:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.