Error Message: Object Reference not set to an instance of an object.

SharePoint - Error Message: Object Reference not set to an instance of an object.

We started getting an error from a component which copies a file to an Office 365 SharePoint site. This upload has been working fine for months and no deployments have been made to it. The error is happening both on the deployed version and when run locally in Visual Studio. We've recreated the issue on several SharePoint sites, using several different sets of credentials. When we go into the SharePoint Connection Manager and hit Test Connection, we get the following error message.
Error Message:
'Object Reference not set to an instance of an object '

Two possible solutions:

1. After COZYROC assessed customer Fiddler Trace files against a SharePoint server that was not failing and 2nd trace file against Sharepoint server that was failing, customer was urged to contact Microsoft with problem on Sharepoint side, not COZYROC SharePoint connection.  Customer reported the following feedback:

Was a problem in Office 365, as per your assessment.

Just FYI, Microsoft helped fixing the problem in the environment. It turned to be an Office 365 setting that had been wrongly applied.

According to Microsoft, someone would have had to run a PowerShell command to change this tenant setting  LegacyAuthProtocolsEnabled to False.


Reference here:

2. It is possible your user account has enabled Multi-Factor Authentication(MFA) and this is the reason for the error.
In version 2.0 COZYROC release a way of connecting with MFA enabled SharePoint service.  Please see this KB article: