Sitecore Rocks: Working with Publishing Restrictions and Reminder fields

So one area that my company utilizes is unpublishing content if the reminder date is more than 12 months old. This works for content pages as most get edited over the course of a 12 month time period. Media items however didn't really make as much sense as things like images, videos, etc would not require editing. I had disabled it for new Media Library items but it didn't reset those reminder dates that were already set to some future date. Sitecore Rocks to the rescue!

First I wanted to know how many items would be impacted, so I wrote a query to retrieve the count of the violators.

select count() from /sitecore/media library//*[@__Unpublish != '']
select count() from /sitecore/media library//*[@__Reminder date != ''] 

Next I decided to review the violators (at least a few).

select @__Unpublish, @@name from /sitecore/media library//*[@__Unpublish != '']
select @__Reminder date, @@name from /sitecore/media library//*[@__Reminder date != '']

Finally I fixed the problem by executing a Sitecore Rocks Update query.

update set @__Reminder date="" from /sitecore/media library//*[@__Reminder date != '']
update set @__Unpublish="" from /sitecore/media library//*[@__Unpublish != '']

Obviously these queries can be altered to search different Sitecore paths so you can do similar logic against other paths. This resolved my issue because I was setting the Item Level publishing restriction using the unpublished date. If you have other fields that you utilize it can easily be modified to cover those fields such as:

Version restrictions:
__Valid from
__Valid to
__Hide version

Item restrictions:
__Publish
__Unpublish
__Never publish

Comments