Retrieve List Items using Portal SiteMap Provider

The Class includes a method called GetCachedListItemsByQuery that retrieves data from a list based on an SPQuery object that is provided as a parameter to the method call.

The method then looks in its cache to see if the items already exist. If they do, the method returns the cached results, and if not, it queries the list , store the results in cache and returns them from the method call.

  Read more

You can use the ListItemCollectionPosition class to implement paging list item retrieval according to the position of items relative to their collection. Use the RowLimit element to specify the number of items to return per page.

The following example loops through all the items in an Announcements list, using the ListItemCollectionPosition property of the CamlQuery class, and the ListItemCollectionPosition property of the ListItemCollection class, to alternately get or set the position of each iteration through a collection, according to five items per page. Read more

The acronym LINQ is for Language Integrated Query. Microsoft’s query language is fully integrated and offers easy data access from in-memory objects, databases, XML documents and many more.

LINQ C# Objects

LINQ Standard Query Operators

Classification Standard Query Operators
Filtering Where, OfType
Sorting OrderBy, OrderByDescending, ThenBy, ThenByDescending, Reverse
Grouping GroupBy, ToLookup
Join GroupJoin, Join
Projection Select, SelectMany
Aggregation Aggregate, Average, Count, LongCount, Max, Min, Sum
Quantifiers All, Any, Contains
Elements ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single,
SingleOrDefault
Set Distinct, Except, Intersect, Union
Partitioning Skip, SkipWhile, Take, TakeWhile
Concatenation Concat
Equality SequenceEqual
Generation DefaultEmpty, Empty, Range, Repeat
Conversion AsEnumerable, AsQueryable, Cast, ToArray, ToDictionary, ToList

Examples

The OfType operator filters the collection based on the ability to cast to a specified type.

In a LINQ query expression, the orderby clause enables you to sort the result sequence into the ascending or descending order based on the default comparer for the element type. The orderby clause may have multiple keys in order to perform the sorting based on different sort operations. By default it sorts the result in ascending order that generates the sequence from smallest to the largest element. The method based syntax of LINQ also allows to specify the custom comparer sorting.

GroupBy transforms a collection into groups. Each group has a key. With this method from the System.Linq namespace, you can do this in your C# program on many collections

  Read more

Close