A typical SharePoint site contains much information that is potentially useful to other systems. SharePoint provides a number of APIs that other systems can use to access and manipulate that information. SharePoint Foundation 2010 includes a new set of libraries, the SharePoint client object model, which client applications can use to access SharePoint’s core services.
These classes act as proxies to a WCF service.
The client object model is actually a set of client and server proxies to a WCF service. However, you do not have to understand the WCF service because the client object model takes care of all of the tedious details of connecting to and communicating with the WCF service.
This is a major improvement over the *.asmx (SOAP) services found in WSS 2.0 and WSS 3.0. To use the SOAP services you must understand SOAP, build and parse XML, and most importantly, understand the specific service. Since these services consume XML, knowledge of the SharePoint object model is only slightly helpful to understanding a given service. Each of the services is a program with its own rules. Understanding how to write code to add an item to a list doesn’t mean you know the specific SOAP service endpoint or how to
format XML that the service understands.
Apart from being complex, the SOAP services are inefficient. Accomplishing most tasks requires multiple round-trips to the server and multiple service endpoints. Those who use hosted SharePoint and can’t deploy code to the farm have no choice and must use the services if they need integration. However, due to the complexity and learning curve of the traditional services, most people build and deploy custom services that support specific use cases to integrate earlier versions of SharePoint with other applications. The traditional SOAP based services are still supported, but unless you are writing code to target both WSS 3.0 and SharePoint Foundation you should use the client object model.
Client Object Model Overview
Figure 1.The client object model and client service handle all communication and message formatting for you.
Doug Ware is a SharePoint expert and an instructor for many of our SharePoint 2007 and SharePoint 2010 courses. A Microsoft MVP several times over, Doug is the leader of the Atlanta .NET User Group, one of the largest user groups in the Southeast U.S., and is a frequent speaker at code camps and other events. In addition to teaching and writing about SharePoint, Doug stays active as a consultant and has helped numerous organizations implement and customize SharePoint.