title: Sharepoint 2010, ClientContext & 401 Unauthorised
body: <p>I'm trying to connect to a Sharepoint instance to publish some content via a 3rd party tool.</p>
  
  <p>I don't have control of the Sharepoint instance, but am assured my account has full permissions.</p>
  
  <pre><code>        ClientContext ctx = new ClientContext("https://thesharepointsite.com");
          ctx.Credentials = new System.Net.NetworkCredential(@"username", "password", "domain");
          Web w = ctx.Web;
          ctx.Load(w);
          ctx.ExecuteQuery();
  </code></pre>
  
  <p>On the ExecuteQuery line, I get the exception:</p>
  
  <pre><code>The remote server returned an error: (401) Unauthorized.
  </code></pre>
  
  <p>(There is no inner exception.)</p>
  
  <p>I can confirm the url &amp; credentials work when I login via a browser.</p>
  
  <p>Based on <a href="https://stackoverflow.com/questions/3935682/401-unauthorized-error-working-with-client-object-model">this question</a>, my assumption is that it is a permissions issue.</p>
  
  <p>If that's the case, then what permission do I need to ask for?</p>
  
  <p>Other questions' I've tried without success:</p>
  
  <p><a href="https://stackoverflow.com/questions/9190975/sharepoint-webservice-401-error">401 Error - Sharepoint 2007</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6999240/sharepoint-server-authentication-error">SharePoint Server Authentication Error</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7554659/401-unauthorized-exception-while-reading-data-from-the-document-library-sharepoi">401 unauthorized exception while reading data from the document library SharePoint 2010</a></p>
  
  <p><strong>Update</strong></p>
  
  <p>I've tried a variety of other queries with the same response.  We have an Sharepoint, Office 365 instance and that works (using <a href="http://code.msdn.microsoft.com/Remote-Authentication-in-b7b6f43c/view/SourceCode#content" rel="nofollow noreferrer">Remote Authentication</a>).  This is also why I believe its some sort of permission or access related.</p>
  
  <p>This is on a customer's instance.  I have only the one account.  I believe if I asked for a 2nd one, it would have the same issue.</p>