Unable to connect to SharePoint Online from CSOM Application

Brass Contributor

Using CSOM Application, I am tried to connect Office 365 SharePoint Online Portal.For Office 365 single sign-on Authentication, Active Directory Federation Services (ADFS) is configured.I tried to connect using the APP Password as well AD Login Password. Both are not working. Please advise.

1 Reply

Hi @Sajith G H 

did you tried use SharePoint PnP Core Online nuget package?

 

You could use AuthenticationManager.GetADFSUserNameMixedAuthenticatedContext method, something like this 

 

var siteUrl = "<a href="https://tenant.sharepoint.com" target="_blank">https://tenant.sharepoint.com</a>";  
var userName = "username";  
var password = GetSecureString("password");  
var domain = "domain";  
AuthenticationManager authManager = new AuthenticationManager();  
ClientContext context = authManager.GetADFSUserNameMixedAuthenticatedContext(siteUrl, userName, password, "sts.company.com", "idpId");

   

 

Please, check official docs in order to understand better all method parameters.

Cheers,

Federico