If you are trying to run CSOM against SharePoint Online and gets the error below
Exception calling “ExecuteQuery” with “0” argument(s): “Cannot contact web site ‘https://tenant.sharepoint.com/’ or the web site does not support SharePoint Online credentials. The response status code is ‘Unauthorized’.
The cause of this issue: LegacyAuthProtocolsEnabled
By default this property should be set to $True, but sometimes it might be set to $False,
Change this back to $True and the authentication error should go away.
https://technet.microsoft.com/en-us/library/fp161390.aspx
LegacyAuthProtocolsEnabled | Optional | System.Boolean | By default this value is set to $True.
Setting this parameter prevents Office clients using non-modern authentication protocols from accessing SharePoint Online resources . A value of True– Enables Office clients using non-modern authentication protocols (such as, Forms-Based Authentication (FBA) or Identity Client Runtime Library (IDCRL)) to access SharePoint resources. A value of False-Prevents Office clients using non-modern authentication protocols from accessing SharePoint Online resources .
|
CSOM error in tenant:
LegacyAuthProtocolsEnabled : False
CSOM worked in tenant:
LegacyAuthProtocolsEnabled : True