SharePoint 2010 introduces the Client Object Model, which is an alternative to web services when accessing data from SharePoint through remote applications. The Client OM provides you with a way to write code similar to the way you would when using the SharePoint API. It comes in 3 different flavors: .NET managed, Silverlight, and ECMAScript.
You start off by creating an instance of the client context. Once you have the context, you can start writing any commands that you’ll need (eg. Commands to retrieve list items). After this, you’ll run the ExecuteQuery method on your client context object which will send your request to the client service on the server. The client service is responsible for executing the requests passed to it and those results are then passed back to the client application.
As you can see, I started by instantiating a ClientContext object. This code is going to return the top 5 items from a products list so I need to pass in the address of the site where the list resides. Next, I create a web and a list object. As you can see, its very similar to what you’re already used to. We don’t have data to work with until we run the ExecuteQuery method.
The code above grabs the top 5 items in the products list and outputs the product name, description, and price (as seen below).