次の方法で共有


Using the SharePoint 2010 Managed Client Object Model – Trimming Result Sets using Lambda Expressions

This is a clipboard friendly version of example #4, Trimming Result Sets using Lambda Expressions, from Using the SharePoint 2010 Managed Client Object Model.

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOC

using System;
using Microsoft.SharePoint.Client;

class Program
{
static void Main()
{
ClientContext clientContext =
new ClientContext("https://intranet.contoso.com");
Web site = clientContext.Web;
clientContext.Load(site,
s => s.Title,
s => s.Description);
clientContext.ExecuteQuery();
Console.WriteLine("Title: {0} Description: {1}",
site.Title, site.Description);
}
}

Following is the same example using fully qualified names for better discoverability.

using System;

class Program
{
static void Main()
{
Microsoft.SharePoint.Client.ClientContext clientContext =
new Microsoft.SharePoint.Client.ClientContext("https://intranet.contoso.com");
Microsoft.SharePoint.Client.Web site = clientContext.Web;
clientContext.Load(site,
s => s.Title,
s => s.Description);
clientContext.ExecuteQuery();
Console.WriteLine("Title: {0} Description: {1}",
site.Title, site.Description);
}
}