开发者

ClientContext Does not Contain a Definition for AuthenticationMode

开发者 https://www.devze.com 2022-12-07 22:00 出处:网络
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 Package

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));
    }
}

}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号