I installed SharePoint Foundation 2010 Client Object Model Redistributable with the intent of creating a basic console app to retrieve the site name as demonstrated in Using the SharePoint Foundation 2010 Managed Client Object Model article on MSDN.
In the section detailing how a developer creates a console application, the article creates the following code:
using System;
using Microsoft.SharePoint.Client;
class DisplayWebTitle
{
static void Main()
{
ClientContext clientContext = new ClientContext("http://intranet.contoso.com");
Web site = clientContext.Web;
clientContext.Load(site);
clientContext.ExecuteQuery();
Console.WriteLine("Title: {0}", site.Title);
}
}
My problem is that the namespace: Microsoft.Sharepoint.Client (squiggly underline underneath sharepoint) is not recognized. As a result, ClientContext and Web are not recognized. What do I do to get this to namespace to resolve?
go to properties for the project and modify "Target Framework" to target ".NET Framework 4" instead of ".NET Framework 4 Client Profile"
Make sure that assembly has been added to your References. You should be able to add it from your 12/14 hive.
According to Microsoft it can be found here:
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With