Introduction
While working with Client Context you might have come across this error in
Visual Studio;
'Microsoft.SharePoint.Client.ClientContext' does not contain a definition for
'Load' and no extension method 'Load' accepting a first argument of type 'Microsoft.SharePoint.Client.ClientContext'
could be found (are you missing a using directive or an assembly reference).
Solution
The reason for the load method error is as follows:
- ClientContext inherits from ClientRuntimeContext.
- ClientContext is defined in Microsoft.SharePoint.Client.dll.
- ClientRuntimeContext is defined in Microsoft.SharePoint.Client.Runtime.dll.
- ClientRuntimeContext defines the Load method.
Add Microsoft.SharePoint.Client.Runtime.dll along with Microsoft.SharePoint.Client.dll to project assembly references. Now you should be good to go.
Happy SharePointing !!!