2

I am trying to pass userid and password through the clientContext.Credentials method, but i am getting the below error

microsoft.sharepoint.client.clientcontext' does not contain a definition for 'credentials'

Below is the code snippet that i am trying to use

var ctx = new ClientContext("SITE URL");
ctx.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials("username", "password");

Also, I have included the below namespaces

using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;

What have i missed? Why is the .Credentials not available?

I am using .Net version 4 for the project

  • 1
    have you included Microsoft.SharePoint.Client.Runtime.dll in your project? – Amit Jun 29 '15 at 4:43
  • Thanks amit, after adding that reference its working :) Can you please tell me what namespace should i add for Microsoft.SharePoint.Client.SharePointOnlineCredentials – Vignesh Subramanian Jun 29 '15 at 4:45
  • you can use "Microsoft.SharePoint.Client". Reference - msdn.microsoft.com/en-us/library/… – Amit Jun 29 '15 at 5:37
6

Please include Microsoft.SharePoint.Client.Runtime.dll in your project.

0

I have the same issue but when copy that dll from SharePoint server your solution has worked but when using NuGet for getting SharePoint 15.0.0 it's not working for me even add runtime reference.

my resolution is: add both Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.RunTime as the reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.