title: how can I Obtain ClientContext in office 365 with fixed credentials (do not prompt user)
body: <p>I am prototyping a tool that runs every few minutes and goes off to an office 365 site and to retrieve and then process information.</p>
  
  <p>At the moment I have started with the MSDN guide <strong>"Remote Authentication in SharePoint Online Using Claims-Based Authentication"</strong> which points to a very helpful code sample that gets a clientcontext object based on a user logging in and then extracts the cookie.</p>
  
  <p>I want to be able to run my code within task scheduler, so that you will be able to specify the office username and password in a configuration somewhere.</p>
  
  <p>Does anyone have any code that will do this or a starting point.
  something like</p>
  
  <pre><code>using (ClientContext ctx = SomeClass.GetContext(targetSiteUrl, username, password))
  {
      if (ctx != null)
      {
          //dostuffhere
      }
  }
  </code></pre>
  
  <p>I have seen this blog post <a href="http://craigsdotnet.blogspot.co.uk/2012/05/automatic-login-for-sharepoint-using.html" rel="nofollow">Automatic Login for SharePoint using Claims authentication</a> but the code on the site doesn't appear to be complete / I cannot get it working</p>
  
  <p>Just to note that I am referring to the current release of office 365 (based on 2010) and not the newly available beta of 2013</p>