开发者

ClientContext Does not Contain a Definition for AuthenticationMode

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜