Saturday, June 23, 2012

SharePoint Client Object Model with Lambda Expressions - Part II

In Part - II, You will learn how to filter query in Lambda Expressions.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;


namespace ClientSideConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new ClientContext(@"http://localhost:22266");
            var web = context.Web;
            var lists = web.Lists;
            context.Load(lists,
                lx => lx.Include
                    (list => list.Title).Where
                        (list => list.BaseType == BaseType.GenericList));
             
            context.ExecuteQuery();
            foreach (var list in lists)
            {
                Console.WriteLine(list.Title);
            }
            Console.ReadLine();


        }
    }
}

No comments:

Post a Comment