Using Regular Expressions For SharePoint List Collection Queries
It’s pretty common that when working heavily with SharePoint based applications that make heavy use of numerous SharePoint lists that you often have to query down into SPListCollection collections using some sort of search criteria. The below example builds a typed collection consuming a regular expression pattern specified as a string literal and an SPListCollection, using a Regex.Match in order to build a typed SPList collection.
-
public static List&<SPList> GetListFromCollectionByName(string pattern, SPListCollection listCollection)
-
{
-
foreach (SPList iteratedList in listCollection)
-
{
-
if (Regex.Match(iteratedList.Title, pattern).Success)
-
{
-
list.Add(iteratedList);
-
}
-
}
-
return list.Count> 0 ? list : null;
-
}
Related posts:
- Using Regular Expressions To Build SPList Collections
- Strongly Typed SharePoint List Collections By Template Type
- Typed Dictionary With SharePoint Web Titles And Typed SPListItem Collection
- Removing Duplicate SPList Objects From Typed Collections
- How To Wire A SharePoint List To A Telerik RadScheduler
1 Comment »
RSS feed for comments on this post. TrackBack URL























Articles & Research
SharePoint Architecture
Research Methodology
Personal/Off-Topic
Article Or Research Filed Under 

[...] Using Regular Expressions For SharePoint List Collection Queries [...]
Pingback by Links (9/7/2009 « Steve Pietrek – Everything SharePoint) — September 7, 2009 @ 4:10 pm