0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.