I am running a very simple Console Application to test SharePoint 2010 client object model. Here is the code
using System;
using Microsoft.SharePoint.Client;
class Program
{
static void Main()
{
ClientContext clientContext =
new ClientContext("http://myserver.contoso.com");
List list = clientContext.Web.Lists
.GetByTitle("Announcements");
clientContext.Load(list);
clientContext.ExecuteQuery();
Console.WriteLine("List Title: {0}", list.Title);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View/>";
ListItemCollection listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
foreach (ListItem listItem in listItems)
Console.WriteLine("Id: {0} Title: {1}",
oListItem.Id, listItem["Title"]);
}
}
The problem is everything works fine. It just that the rows are not retrieved from any list or library. The collection is always empty even if there is data in actual list.
Any ideas ?
This example is exact copy paste from MSDN
