Friday, February 20, 2009

Content and Structure Reports: Stale documents

Ever wanted to find out where your unused documents lie in MOSS?
This is the syntax to find all documents that have not been modified in the last year. The field to check against is the Last Modified Date. Best is to use it's ID.

<Where><Leq><FieldRef ID="{173f76c8-aebd-446a-9bc9-769a2bd2c18f}"/><Value Type="DateTime" IncludeTimeValue="TRUE"><Today OffsetDays="-365"/></Value></Leq></Where>

Remember not to have any whitespace in between the tags, especially no CRLF.

The trick here is not to use [Today] but instead also use the OffsetDays to go back and forward in time and if you want to make sure that the time is matched, include the IncludeTimeValue="TRUE" attribute. This attribute comes in handy in many cases when you want to check against "Now".

No comments: