1

How do you use a KeywordQuery to search for "last modified by" and "last modified date"?

This is for SharePoint 2010 Server, with publishing pages and document libraries, so "enterprise search". I'm currently using the query like so:

new KeywordQuery(SPContext.Current.Site)
{
    QueryText = "query",
    // ...
};

1 Answer 1

1

If you use a KeywordQuery, both of these are easily searched upon.

For "last modified by", you can simply add:

and Author:"domain\user"

...to the Query. This will only return items who were last updated by domain\user.

For "last modified date", this is most easily filtered upon when the search results are already gathered, by using a RowFilter on a DataView made from the DataTable returned by the KeywordQuery:

dataView.RowFilter = "write <= '1989-12-24'";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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