locked
Checking version history for a list item RRS feed

  • Question

  • Hello all,

    I'm writing a method that is designed to check whether a given user has edited any list items which have been created in the last week. The item doesn't have to belong to them, it just has to exist and have been edited by that user (not just a creation). Currently, I'm using a SPQuery that looks like this:

    itemQuery.Query = "<Where><And><Gt><FieldRef Name='Created' /><Value Type='DateTime'>startTime</Value></Gt>
    <Lt><FieldRef Name='Created' /><Value Type='DateTime'>endTime</Value></Lt></And></Where>"
    As far as I can tell, this should retrieve all list items created in the last week (there's some separate code to retrieve the start and end dates, but I know those work).

    Now, assuming my query works, is there a way to go through the version history of each item in the SPListItemCollection and see if the user modified it? I can't find any way to access the history from the SPListItem class, so now I'm asking for help.

    Also, if there's an easier way to implement this method, I'd love to hear it. I'm new to SharePoint development, so I would appreciate feedback.

    Thanks!
    Tuesday, June 23, 2009 8:01 PM

Answers

All replies