- Business logic
- governance
- application development
- BizTalk
- SharePoint
- database
- jQuery
- SOA
- programming
- Visual C#
- Visual Studio
- Exchange
- documents
- PHP
- services
- Microsoft Office
- customization
- Exchange server
- security
- collaboration
- .NET
- SharePoint 2010
- CA
- CodePlex
- developer
- search
- document management
- portal
- WSS
- Web development
- Web sites
- authentication
- XML
- Microsoft
- software
- policy
- MOSS
- Web Parts
- Office
- Silverlight
- tools
- sandbox
- SharePoint Service Account
- InfoPath
- ASP.NET
- Windows
- server
- architecture
- Libraries
- SharePoint administration
Getting Started with Client-Side Object Modeling
Client-Side Object Model (OM) is a new way to work with SharePoint 2010 from client-side machines. This not only removes the need of running the code on the server side, it also unleashes great power to developers. This article will describe the use of client-side object modeling by using a .NET-managed API.To work with your .NET-managed client API, you will need to reference the following two assemblies. In case SharePoint 2010 is not locally installed on your development machine, you'll need to copy these two assemblies locally.
The naming conventions used in Client Side OM resembles that of Server Side OM, which simplifies Client Side OM. The following table shows some of these similar naming schemes.
The following steps show how to create a simple Windows Form application and perform operations with SharePoint 2010. The application will use Client Side OM to get all the lists/libraries on a SharePoint 2010 web and then delete any of the lists/libraries. The SharePoint 2010 Lists/Libraries will be in the displayed using a ListBox, and deletion will be done in response to a ContxtMenu event.
1. Create a new Visual Studio 2010 Project of type Windows Forms, named the project "Client OM". Please note that although this example uses Windows Forms application, you can use other project types like "Windows Console Application" when working with .NET Managed Code.
2. Add the following two assemblies to the Visual Studio project; they are located at "
3. Now add the following controls on the "Form1." The final result along with layout are shown below.
4. Also add new Tool Strip Menu Item "Delete List", as shown in the figure below.
5. Add the Button Clicked event to the Button "btnGetLists", you may want to double click the button to achieve this. Also double click the Tool Strip Menu item "Delete List, this will also generate the event automatically.
6. To fill the list box with SharePoint 2010 List/Libraries, create a new method titled "FillListBox", as shown below.
The method is to first create a new client context with the site provided in the text field "txtUrl." This is a mandatory step; also note that "ClientContext" needs to be disposed properly, that's why its wrapped in using statement. Once the context is created, you can now start working with objects, the first one is the "Web", and in this case it's pointed out to the root web in the site collection.
Next, a "Load" method is used to fist Load the web and then the "Lists" in the form of "ListCollection." This in fact points to the architecture of client OM, as the code is not running on a server, and the actual call to the server will be delayed until the call to "ExecuteQuery" is made, which in turn will make the actual call to the server. To summarize, the Load commands will be batched and then executed on the server once "ExecuteQuery" is called. Finally, loop through all the lists/libraries and add them to the List Box. Do take note that, if the call to "ExecuteQuery" method is missed, then the following exception will be raised.
7. In order to delete the "List/Library" from the SharePoint web, create a new method named "DeleteList" as shown below.
This method first makes confirmation by displaying a message dialog. Next, the context is established to the SharePoint site, then the "Load" method is used to load Web, followed by the call to "GetByTitle" method inside the "ListCollection" class. This method will get the SharePoint "List" by its "Title." After the List is loaded, the call to "ExecuteQuery" is made to actually run the batched commands on the server. For deletion of List/Library, the method "DeleteObject" inside the "List" class is called, followed by call to "ExecuteQuery", which will actually remove the list/library from the server.
Finally a "List Deleted!" message is shown, and call to "FillListBox" is made, to re-populate the list box.
8. Compile and Run the application by pressing F5.
9. Enter the URL for the desired SharePoint Site (e.g http://win2k8-r2-01) and press "Get Lists" button on a running Windows Form application. The list will be populated with root web's Lists/Libraries.
10. Select a List/Library that you want to delete, and right click the mouse on it, and select "Delete List."
11. Confirm the deletion of a List/Library by clicking "Yes" button. The List will be deleted and a success message will be shown. Also note that the list is now removed from the ListBox because it does not exist on the server.

Discover how to start developing for the Android platform with this extensive guide, which provides a reference to the Android platform as well as a look at developing your first Android application. You'll explore the top 10 features for developers as well as learn design and development tips that go beyond the phone and target tablet development as well.