In this article we will discuss how we can retrieve selected properties of a website using SharePoint 2013 object model.

If you follow this article to retrieve website title using SharePoint 2013 object model, then here context.Load(web); will load all the properties of the website.

But suppose we need only two properties like Title and Description then it is unnecessary to bring all the properties from the server to the client. So client object model provides anonymous methods which uses lambda expressions, to specifically request property names.

The client library will query only for those properties on the server, and the server will send only those properties to the client. This technique reduces unnecessary data transfer between the client and the server.

Below is the full code:

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.

About Author:

I am Bijay from Odisha, India. Currently working with a reputed organization in Bangalore. I am Microsoft Office Servers and Services (SharePoint) MVP (3 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.... view full profile

Comments

To insert images, Upload images
here
or you can use flickr or picasa to upload images. After that paste the image url
in the editor image dialog box.