I am having troubles to get it running and wanted to ask you if you know if it is possible to use CSOM in SP 2013 Farm Solutions?
I constantly get an 401 unauthorized exception.
Here is how I create the clientcontext:
this.webUrl = SPContext.Current.Web.Url; this.siteUrl = SPContext.Current.Site.Url; clientContext = new SP.ClientContext(this.webUrl); clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;
As I want to share the code between an SharePoint Autohosted app and my farm solution I have to use the CSOM.