Content Manager leaves job - with locked items! Sitecore Rocks to the rescue

The scenario one of your content editors or managers leaves the company without checking in all of their items in Sitecore. I think this is a scenario that we all have or will face at some point in our Sitecore career. Obviously an admin could manually unlock items one by one, but who wants to bother taking the manual approach when utilizing Sitecore Rocks query analyzer is so much easier.

Finding the locked items:

select @@name, @@Path, @__Lock from /sitecore/content//*[contains(@__Lock,'username')]

Now that we have located the items, we have to make a decision on whether to release all the locks or reassign them to another editor. Typically I tend to just release the locks however there are times where you may want to reassign them to another editor so that they have a complete list of items in progress. I'll cover both scenarios below:

Release the lock:

update set @__Lock="<r />" from /sitecore//*[contains(@__Lock,'username')]

Replace the editor:

replace "oldusername" with "newusername" in @__Lock from /sitecore//*[contains(@__Lock,'oldusername')]

Side note: Any NJ content managers looking to join Mathematica Policy Research and work directly with a Sitecore MVP? If so, apply for the Web Strategy and Content Manager position