Sometimes we have to reach a SharePoint list through remote connections using C#. It can happen in a SharePoint App, a Console Application or maybe on an Azure Worker Role.

Below you can find some code snippets that will help you on integrating SharePoint lists with your application.

Basically, you will have to add the Microsoft.SharePoint.Client namespace.

using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

The required DLLs for programming these type of solution are:

Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll

You can find them inside those folders:

SharePoint 2010: 14 Hive -> Folder: ISAPI

SharePoint 2013: 15 Hive -> Folder: ISAPI

Or just download it from MSDN, inside the SharePoint Server 2013 Client Components SDK!

After adding these references to our project, we can start coding.

Soon you will notice that everything depends on the ClientContext object, which manages the requests and the data that will be loaded.

In our examples we are going to use the variable siteUrl, that represents the URL for the Site Collection. The variable listTitle will also be used and it represents the Title of the list being used.

string siteUrl = "http://sitesharepoint";
string listTitle = "SharePointList";

So, let’s do some real stuff here:

Reading SharePoint lists:

Filtering SharePoint lists and selecting specific fields:

Creating list items:

 Updating list items:

 Deleting list items:

I believe these are the basics for consuming SharePoint lists. In the future I’m planning to show some complex examples, more focused on Office 365 and Azure integrations. Thanks for reading and I hope it can be useful to you

References:
MSDN