Rana
Rana

Reputation: 1755

Cannot Refer to Microsoft.SharePoint.Client.dll

I am creating a Windows application the will access a sharepoint website. There for I need to use Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.runtime.dll in project.

I have add them in my references but cannot use it. Can someone help me?

Please see the issue here: Issue

using Microsoft.SharePoint.Client;

namespace WpfApplication3
{
 public partial class MainWindow : Window
 {
    public MainWindow()
    {
        ClientContext context = new ClientContext("http://hp");
        InitializeComponent();
    }
 }
}

Upvotes: 2

Views: 4241

Answers (1)

Equalsk
Equalsk

Reputation: 8214

The bottom of your screenshot tells you explicitly what is wrong. You seem to be targeting .NET 4.0 Client Profile which does not contain a reference for System.Web which is a dependency of the SharePoint Client.

Re-target your project for .NET 4.0.

If you're using Visual Studio go to Project > Properties > Application > Target Framework > Change it to 4.0 (NOT Client Profile)

enter image description here

Upvotes: 3

Related Questions