Client Side Object Model (CSOM)?

Client Side Object Model (CSOM)?

Client-side object model(CSOM) is used to access SharePoint remotely, means using the .net managed code developer easily can access SharePoint functionality. It was introduced in SharePoint 2010. Client.svc one of the web service is the heart of Client side object model(CSOM), which lives in the _vti_bin virtual directory.SharePoint Client-Side Object Model (CSOM) to use develop task like Update, Insert, Retrieve data in SharePoint Project server 2013(Online and On-premise).
There are two assemblies for .net managed code to access SharePoint remotely using CSOM
Below are steps to add this assembly to your simple console application with .net managed code.

1. Open visual studio and create a simple console application.
2. Add two SharePoint dlls as given
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll

Below is code to access SharePoint using Client side object model


If you are using CSOM inside SharePoint farm, means inside SharePoint Web Part etc then you don’t need to pass User Id and Password to authenticate the user because the code is running in user context like this.

If you want to access SharePoint remotely then you need to pass your service account user id and password like this.

for SharePoint on-premises

for SharePoint Online change this line only