CSWP (Content Search Web Part) - "Item related to current user (System)"

Iron Contributor

I need help with a very straight forward requirement. On my main SharePoint landing page I need to show all the documents that the user changed recently. So it would show different results for different users based on what documents they worked upon.

 

The CSWP's default query "Recently changed items (system)" works great with filter of "modified by" as "name of user who runs the query".  The only issue being that if two users change a document, then the "Recently changed items (system)" report will no longer show the document to the first user since now the 'modified by' is changed to second user.  I would like to still be able to show the document in first user's queue.

 

As an alternate I tried the other default query "Item related to current user (System)". It does returns results, but it also returns result for documents which I never touched (i.e. I never moved, viewed or modified or created those items which are showing up in my search results).  Evidently I need to learn more about "Item realted to current user (System)" query. I tried searching here and Google searches about this default report but there no sources which describe this in minute details.

 

Appreciate any help. Thanks.

 

 

 

2 Replies

Hi Vivek one thought would be to modify the query to be "Modified By " OR "Created By" which may solve your issue.  However if you have lots of people working on a file, this won't work.  The only work-around we've done, which disables co-authoring if you are using that, is:

  1. Force check-in / check-out of documents
  2. Add a people-picker field to the library(s) that will populate the CSWP and call it "Contributors"
  3. Setup a workflow on the library(s) that will populate the CSWP that fires on create and on change... "Wait for document to be checked in... then 1) check out 2) (need a local variable to do this) aggregate Last Modified to Contributors field on the document 3) check-in the file
  4. Set the CSWP to be "If Contributors contains [Me]..."

This way you have an entire list of anyone who contributes to the document and you can query from it.

 

Good luck!

 

Thanks Joel. This is very helpful.