Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to list all documents that were (ever) modified by a specific user, using a CAML query like this one:

var query = new CamlQuery{ ViewXml = 
  "<View Scope='Recursive'>" + 
    "<Query>" +
      "<Where>" + 
        "<Contains>" +
          "<FieldRef Name='Editor' LookupValue='TRUE' />" + 
          "<Value Type='Text'>Frank van Puffelen</Value>" +
        "</Contains>" + 
      "</Where>" + 
    "</Query>" +
  "</View>" };

On an item level there are the Editor and Author fields that seem promising. But unfortunately the Editor field seems to only identify the person who modified the most recent version, while I am looking for documents that were modified at any point by this user.

Say I have a document with this version history:

  1. John Doe
  2. Frank van Puffelen
  3. John Doe

Then the item will show "John Doe" as both its Author and its Editor. So this document will not show up when I search for items modified by "Frank van Puffelen" with the CAML query above.

So far the only way I've been able to get the necessary information is to open the version history of each item. But that is of course quite costly and I'd prefer to prevent it if possible.

Is there any way to search the version history using CAML like this? Or is there another search technique that would get me the list of documents that a specific user contributed to?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Frank, I don't think it's possible to do what you want. If search returned all of the versions, we'd have a real mess on our hands. You're right that the Author (Created By) is the original creator and the Editor (Modified By) is the last person who made an update. To add to the complexity, those roles may have only made changes to metadata and not the document itself.

If you need to be able to reliably get at what you seek, you'll need to make considerations in your architecture going forward to track the details along the way.

share|improve this answer
    
Thanks Marc. You confirmed what I feared already, but I was hoping there was some way to join the versions into the CAML query. –  Frank van Puffelen Jul 23 '13 at 16:33
add comment

The SharepointAudit logs keep track of that stoff if auditing is enabled on your site. You can use an SPAuditQuery to get all the Documents Frank van Puffelen updated. You could look at http://www.codeproject.com/Articles/431342/Auditing-A-Built-in-Feature-of-SharePoint

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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