Wednesday, May 1, 2013

Get website title using SharePoint 2013 client object model




In this post we will discuss how to retrieve website Title using SharePoint 2013 client object model. Also you can check previous posts on:
- CAML designer for SharePoint 2013

- New features in SharePoint 2013 event receiver

- Hardware and Software requirements in SharePoint 2013

To work with SharePoint 2013 client object model, we need to give reference to the below dlls:

- Microsoft.SharePoint.Client.Runtime.dll

- Microsoft.SharePoint.Client.dll

These dlls are located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI.

Below is the full code to retrieve the title of a website:

using Microsoft.SharePoint.Client;

ClientContext context = new ClientContext("http://URL of the Site");

Web web = context.Web;

context.Load(web);

context.ExecuteQuery();

string Title = web.Title;


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Favorites More