LINQ/Lamba and SharePoint « In Development - Dec 4, 2009
[…] ran into a very nice article about using Lambda’s/LINQ on SharePoint objects. You can find it here. Categories: LINQ, Lambda, SharePoint Tags: Lambda, LINQ, SharePoint Comments (0) […] denni - Dec 1, 2009
In this case, you can use Cast() instead of OfType() for better performance. [rfarqleet]( “rfarqleet@xavor.com”) - Feb 3, 2010
Good work! http://www.xavor.com/whatwedo/solutions/sharepointmigrationtool.aspx
English
Before you continue reading this post, I hope you have read the basic task to start using lambda expression in SOM here.
A. Find any Event list in site.
SPWeb spWeb = SPContext.Current.Web
var lists = spWeb.Lists.OfType().Where(
l => l.BaseTemplate == SPListTemplateType.Events);
foreach (SPList list in lists)
{
Console.WriteLine(“{0} {1}”, list.BaseTemplate.ToString(), list.Title);
}
B. Find any list based on custom list definition with Type=20080
SPWeb spWeb = SPContext.
English
Before you continue reading this post, I hope you have read the basic task to start using lambda expression in SOM here.
A. Find existing job definition, named “Change Log”
SPWebApplication spWebApplication = SPContext.Current.Site.WebApplication;
var jobs = spWebApplication.JobDefinitions.Where(x => x.Title == “Change Log”);
foreach(SPJobDefinition job in jobs)
Console.WriteLine(job.Id);
B. Find existing custom job definition MyCustomJobDefinition, named “My Custom Job”
SPWebApplication spWebApplication = SPContext.Current.Site.WebApplication;
var jobs = spWebApplication.
Howto series : Lambda and SharePoint « Ideas for free - Sep 2, 2009
[…] How to use lambda expression in SharePoint Object Model. 2. How to use lambda expression in SharePoint Object Model – working with WebApplication. 3. […] [Sneha]( “sneha.rishi@gmail.com”) - Feb 5, 2010
Hey , Nice article !! . I am trying to write a lambda expression which can fetch all lists that are based on a particular content Type .
English
Lambda expression has been introduced since .NET framework 3.5, it is an anonymous function that can contain statement and expression. For more understanding on lambda expression you can read directly in MSDN page here. I will assume that you have read the topic and you can remember the lambda simply as:
(input parameters ) => operation
We will start with very basic operation of using lambda expression in SOM, and I hope you’ll find your path for more complex one.