Having done some projects that that use the standard web services in SharePoint 2007 I was really looking forward to try this new feature in SharePoint 2010! Here are some of the CRUD stuff I played around with:
The basic concept for retrieving and reading data:
// Create a client context based on the full web url of the SharePoint server
var context = new ClientContext("http://192.168.0.125");
// Set the object to load default values for
context.Load(context.Web);
//Execute the queue (Get data from the server)
context.ExecuteQuery();
// You can now use default properties of the web object
MessageBox.Show(context.Web.Title);
As the code comment says, when you define a web to be loaded all the default/standard properties are loaded into the web object, though this does not include lists, sites etc., if you only want to load a few properties to save some bits the load call can be made with:
// Load only Title and Id from the Web
context.Load(context.Web, w => w.Title, w => w.Id);
If an unloaded property is called a “PropertyOrFieldNotInitializedException” will be thrown.
Here is another example that shows how to retrieve contacts from a SharePoint contact list, that has an “e” in the first name, the list name is “EmployeeList”
var context =
new ClientContexthttp://192.168.0.125);
// Notice the different load call, LoadQuery can make use of LINQ
var lists = context.LoadQuery(context.Web.Lists.Where(l => l.Title == "EmployeeList"));
context.ExecuteQuery();
var employeeList = lists.SingleOrDefault();
var query =
new CamlQuery { ViewXml = "<View><Query><Where><Contains>"
+"<FieldRef Name=
'FirstName'/><Value Type=
'Text'>e</Value>"
+"</Where></Contains></View></Query>" };
var items = employeeList.GetItems(query);
context.Load(items);
context.ExecuteQuery();
var nameList = new List<string>();
items.ToList().ForEach(i=> nameList.Add(i["FirstName"].ToString()));
employeeListBox.ItemsSource = nameList;
As you can see, you can pretty much dig deep into the SharePoint site before executing the first query, it seems very efficient and is much faster to work with when compared to the old standard web services. But sadly I do not think there is a way to use LINQ for list items and folders, so (at least for now) CAML is still alive and kicking on the client side. If you do not need to filter your items or folders there are some standard queries in the CamlQuery entity.
var itemsQuery = CamlQuery.CreateAllItemsQuery();
var folderQuery = CamlQuery.CreateAllFoldersQuery();
The result from the above code with the CAML filter:

After retrieving an item we can update its properties by simply setting them and calling update (continuing the code from above):
items[0]["FirstName"] = "UpdatedFirstName";
items[0].Update();
context.ExecuteQuery();
And now the first name of item[0] is updated

And if you want to delete a list item, it is just as easy:
items[0].DeleteObject();
items[0].Update();
context.ExecuteQuery();
A few pros about the new Client OM:
- Same API structure as the server side API
- Works with managed .Net Applications, Silverlight applications and JavaScript
- Highly productive compared to the old web services
- Easy to limit bits sent over the wire
- JSON Server response
- Lowers the need for CAML
For more information about the new Client OM see msdn