Target Environment : SharePoint Online
Coding Technique : Csom
Hi All,
I am facing the challenge with connecting to a sharepoint online site using csom. We are having 2 way authentication to connecting a site.
Example:
If
https://csharpcorner.microsoft.com is a Online Site while loading we have to
[email protected] & followed by the next below window with domain name.
username : domain\username
Password : ******************
because of this i couldn't able to connect a site with my code.
Code
string userName = textBox1.Text;
string password = textBox2.Text;
SecureString SecurePassword = GetSecureString(password);
clientContext.Credentials = new SharePointOnlineCredentials(userName,SecurePassword);
Web web = clientContext.Web;
clientContext.Load(web);
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
clientContext.ExecuteQuery();
I'm getting the below exception.
Error
Can anyone assist me on this issue asap.
Thanks
Raghav