title: Document Version History via CSOM
body: <p>I'm currently trying to pull the document history of a SharePoint 2010 site collection via CSOM.</p>
  
  <p>The code that I am using to accomplish this is here:</p>
  
  <pre><code>using (var clientContext = new ClientContext("http://localhost/sites/mysite"))
  {
      File file = clientContext.Web.GetFileByServerRelativeUrl(url);
                  clientContext.Load(file, f =&gt; f.ListItemAllFields);
                  clientContext.ExecuteQuery();
  }
  </code></pre>
  
  <p>Whenever I run this code it throws an exception stating:</p>
  
  <p><strong>Server Exception was Unhanded by User Code</strong></p>
  
  <p><em>Value does not fall within the expected range</em></p>
  
  <p>Please Note that:</p>
  
  <ul>
  <li>Version History is Turned On</li>
  <li>Changing f.ListItemAllFields to f.Versions does not fix it either.</li>
  </ul>