Custom Web part based on search object model to query accross site collections
-
16-10-2019 - |
Question
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?
Solution
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).
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange