Freigeben über


Using the SharePoint 2010 Managed Client Object Model – First Example

Using the SharePoint 2010 Managed Client Object Model – First Example

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

Blog TOC

This is a clipboard friendly version of example #1 from Using the SharePoint 2010 Managed Client Object Model.

using System;
using Microsoft.SharePoint.Client;

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

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

using System;

class DisplayWebTitle
{
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);
clientContext.ExecuteQuery();
Console.WriteLine("Title: {0}", site.Title);
}
}