6

Which solution from the two is the most efficient one: 1. Using SPList.GetItems with a given view as a parameter 2. Using SPList.GetItems with a given query as a parameters and then retrieving from the cache the remaining details of the item.

Thank you all for your answers. But I want to emphasize that with the query I will retrieve only the id of the item and then the rest of the details from the cache versus retrieve all the item's details using prepared view.

3 Answers 3

2

The fastest would be SPList.GetItems Method (SPQuery, String).

However, in case you are referring to large lists and libraries, take a look at Handling Large Folders and Lists.

1

The speed of both is almost the same as both leads to the same complex code which takes 3 parameters: list, query and viewname. The second method is for creation of 1 empty SPQuery object faster. From my point of view the drawback of first method is that you must construct or have prepared the view.

1

Technically, views are nothing but saved collaborative markups that describe the contents to be shown. The motivation behind various overloads for GetItems() is to ease the task of getting items and reduce the knowledge you need to use SharePoint Api.

If you're not happy with writing CAML you can build a view in the front-end and use its name in the overload.

Your Answer

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

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