The type or namespace name ‘Web’ could not be found (are you missing a using directive or an assembly reference?)

Tags: Microsoft.SharePoint.Client, sharepoint, assembly reference

Issue:

I recently got this error while creating a sample SharePoint auto-hosted app. Following line was giving error:

Web siteCollection = clientContext.Web;

You might see error like this:

image

Solution:

Add ‘Microsoft.SharePoint.Client’ namespace.

In order to use managed client object model, we must add references to the assemblies 'Microsoft.SharePoint.Client.dll' and possibly 'Microsoft.SharePoint.ClientRuntime.dll'

1 Comment

Add a Comment

Recent Posts