How to use the client object model with SharePoint2010
        Posted  
        
            by ybbest
        on YBBest
        
        See other posts from YBBest
        
            or by ybbest
        
        
        
        Published on Thu, 17 Jan 2013 09:42:11 +0000
        Indexed on 
            2013/06/24
            16:40 UTC
        
        
        Read the original article
        Hit count: 486
        
In SharePoint2010, you can use client object model to communicate with SharePoint server. Today, I’d like to show you how to achieve this by using the c# console application. You can download the solution here.
1. Create a Console application in visual studio and add the following references to the project.

2. Insert your code as below
            ClientContext context = new ClientContext("http://demo2010a");
            Web currentWeb = context.Web;
            context.Load(currentWeb, web => web.Title);
            context.ExecuteQuery();
            Console.WriteLine(currentWeb.Title);
            Console.ReadLine();
3. Run your code then you will get the web title displayed as shown below

Note:
If you got the following errors, you need to change your target framework from .Net Framework 4 client profile to .Net Framework 4 as shown below:

Change from

TO


© YBBest or respective owner