title: Retrieve list item using CSOM on SharePoint online isn't working
body: <p>m developing an app model on SharePoint online using the provider hosted model.</p>
  
  <p>From clientwebpart, I want to access a Sharepoint list item. I can access list a object but can't get the list item (always empty). I already followed the sample code at "Apps for SharePoint sample pack - SharePoint 2013 Perform basic data access operations by using CSOM in apps", but still does not work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>SharePointContextToken contextToken;
  Uri sharepointUrl;
  string accessToken;
  
  TokenHelper.TrustAllCertificates();
  string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
  
  if (contextTokenString != null)
  {
      contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
  
      sharepointUrl = new Uri(Request.QueryString["SPHostUrl"]);
      accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;
  
      using (ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString(), accessToken))
      {
          Web web = clientContext.Web;
          ListCollection lists = web.Lists;
  
          List selectedList = lists.GetByTitle("LeaveCategory");
  
          clientContext.Load&lt;ListCollection&gt;(lists); // this lists object is loaded successfully
          clientContext.Load&lt;List&gt;(selectedList);  // this list object is loaded successfully
  
          clientContext.ExecuteQuery();
  
          CamlQuery camlQuery = new CamlQuery();
          camlQuery.ViewXml = @"&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;IsNotNull&gt;&lt;FieldRef Name='ID' /&gt;&lt;/IsNotNull&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name='ID' /&gt;&lt;/ViewFields&gt;&lt;/View&gt;";
  
          Microsoft.SharePoint.Client.ListItemCollection listItems = selectedList.GetItems(camlQuery);
  
          clientContext.Load&lt;Microsoft.SharePoint.Client.ListItemCollection&gt;(listItems); // problem here, this list items is return empty 
  
          clientContext.ExecuteQuery();
      }
  }
  </code></pre>
  
  <p>Is there any trivial mistake that I am making?</p>
  
  <p>Also, I am trying to create fresh new project and follow instruction of <a href="http://msdn.microsoft.com/library/office/fp142381%28v=office.15%29" rel="nofollow">How to: Create a basic provider-hosted app for SharePoint</a>, and appending code toretrieve list item, but it still returns 0 item.</p>
  
  <p>Did anyone ever succeeded achieving this?</p>