Friday, June 24, 2011

How to Impersonate SharePoint Client Object Model

Using this you can pass dedicated credentials to SharePoint client object.

using System.Net;
using Microsoft.SharePoint.Client;

ClientContext context = new ClientContext("http://server/");
context.Credentials = new NetworkCredential("user", "password", "domain");
// Some Cording
context.ExecuteQuery(); 

2 comments:

Anonymous said...

Thank you for the code... but after declaring 'ClientContext context = new ClientContext(site);'

context has only the following variables. ServerVersion, Site, Web and method 'ExecuteQuery'.

I am not sure why that is? Could you please kindly shed some light. Thank you again for your time.

Melick Rajee said...

hi,

what is the version u are using ? I'm using 2010 Enterprice. And did u refer the correct client dll ?