by XDK
11. September 2013 11:59
Exception:
'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)
Explantion:
I got the above exception while using 'Microsoft.SharePoint.Client.ClientContext' load method in my share point web part project. Adding Microsoft.SharePoint.Client.Runtime.dll to project assembly references resolved the errors. 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
Soultion:
Add Microsoft.SharePoint.Client.Runtime.dll along with Microsoft.SharePoint.Client.dll to project assembly references.