Monday, March 4, 2013

How to Impersonate SharePoint Client Object Model

How to Impersonate SharePoint Client Object Model

Using this you can pass dedicated credentials to a SharePoint client object!

// Bring in the libs!
using System.Net;
using Microsoft.SharePoint.Client;

// Add our context to Impersonate
ClientContext context = new ClientContext("http://server/");
context.Credentials = new NetworkCredential("user", "password", "domain");

// Execute Him!
context.ExecuteQuery();

SharePoint 2010. It's a love/hate relationship and I think my farms are getting jealous of the time I am spending with SharePoint 2013. Why else would the Secure Store and BCS fail as soon as I spun up a SharePoint 2013 VM?

##########
##  Sigh  ##
##########


No comments:

Post a Comment