SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for examples how to build a web part (code) that queries all doc libs in a web application (Done by a created search scope, a scope exists with all the docs from all doc libs) and displays the last 10 created documents.

What's the best method to use? Is FullTextSqlQuery sqlQuery = new FullTextSqlQuery(SPContext.Current.Site); a valid option or should I use LinQ?

share|improve this question
up vote 0 down vote accepted

FullTextSqlQuery is a valid approach (requires SharePoint Server). You could also consider the KeywordQuery class.

Link on MSDN.

Example code for tasks list (class derived from search web part).

share|improve this answer

Your Answer


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.