Category: SPSiteDataQuery vs CrossListQueryInfo

Query SharePoint List – SPQuery vs SPSiteDataQuery vs CrossListQueryInfo

There are three different classes you can use to query SharePoint list:-

1.       SPQuery

Used for query a data from a specific list and also used for join two lists.

Use full Links:-

2.       SPSiteDataQuery

Used for cross site query. Query a data within site collection or specific web.

3.       CrossListQueryInfo(The best one)

The CrossListQueryInfo object uses the CrossListQueryInfo object to get the cached results or, if there are no cached results available, it performs a cross-list query to the database and then caches the results for future use. Audience targeting is then applied to the result set, depending on the setting specified in the CrossListQueryInfo object. You can use the CbqQueryCacheobject to obtain a CrossListQueryInfo object for a specific Content by Query Web Part.

4.    KeywordQuery Class
            In order to develop custom search web parts or applications that support ‘search-by-keyword’ scenario, SharePoint Query object model exposes KeywordQuery Class.
Advertisements