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

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",
    // ...
};
share|improve this question

1 Answer 1

up vote 1 down vote accepted

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'";
share|improve this answer

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.