How to use Client Object Model with Lambda Expressions.
First we have to add given references to project.
Microsoft.SharePoint.Client
Microsoft.SharePoint.Client.Runtime
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;
context.Load(web, x => x.Title, x => x.Description);
context.ExecuteQuery();
Console.WriteLine(web.Title);
Console.WriteLine(web.Description);
Console.ReadLine();
}
}
}
Above code loads only title and description for given web.
No comments:
Post a Comment