I had a script that worked earlier today, but when I restarted my machine I now get ClientContext does not contain an definition for 'AuthenticationMode'. I have tried reinstalling the Nuget Packages. I have tried restarting my machine,开发者_运维知识库 no luck. I have another project that uses the same clientContext.AuthenticationMode, and also works fine. How do I fix this reference issue?
ClientContext.Credentials works but ClientContex.AuthenticationMode does not.
public void GetSharePointSite()
{
string sharepointURL = $@"https://mySharepointSite";
using (ClientContext clientContext = new ClientContext(sharepointURL))
{
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;
//load subsites and their titles
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
Console.WriteLine(Convert.ToString(web.Title));
}
}
}
精彩评论