Directory synchronization report contains an "incompatible object type" error in Office 365 or Exchange Online Protection

Applies to: Exchange OnlineExchange Online ProtectionCloud Services (Web roles/Worker roles)

PROBLEM


Office 365 or stand-alone Exchange Online Protection subscribers who formerly subscribed to stand-alone Forefront Online Protection for Exchange (FOPE) receive a directory synchronization error report that identifies the following conflict:
An object with the same proxy address already exists in Windows Azure Active Directory but is of an incompatible object type (object classes: contact, group, or user). Correct this issue in the local directory services or in Windows Azure Active Directory and try again.
The following is an example of the error report:

Screen shot of an example of the directory synchronization error report

Additional columns in the error report list the identity and on-premises object ID for conflicting objects.

CAUSE


This problem occurs because migrated distribution groups and contacts from stand-alone FOPE to Exchange Online Protection were created with an incorrect object class for directory synchronization soft matching.

SOLUTION


To resolve this issue, remove the conflicting users from Office 365. To do this, create a list of users to be removed, and then run a Windows PowerShell command to perform the removal process. To do this, follow these steps: 
  1. Connect to Azure AD by using the Microsoft Azure Active Directory Module for Windows PowerShell. For more info about how to do this, see Manage Azure AD using Windows PowerShell.
  2. Sign in to the Exchange admin center, and then set all affected domains to Internal Relay to make sure that that mail flow is not affected during the object type correction interval. For more info about how to do this, see Managed accepted domains in Exchange Online.
  3. Run the following command to export a list of all Office 365 or Exchange Online Protection users to a Users.csv file:
    Get-MsolUser -All | Where {$_.ImmutableID -eq $null -and $_.IsLicensed -eq $false –and $_.ProxyAddresses –ne “”} | Export-CSV C:\users.csvU 
  4. Use Microsoft Excel or a text editor to open the Users.csv file. 

    Important When you perform these steps, do not modify or delete the top two lines of the spreadsheet, because they contain important header information.
    1. In the spreadsheet, delete the rows that are associated with the users whom you want to keep in Office 365. 
    2. Save the file as Users-modified.csv.
  5. Run the following command to remove the users from Office 365:
    Import-CSV C:\users-modified.csv | Remove-MsolUser –Force 
  6. Force directory synchronization. For more info about how to this, see Synchronize your directories
  7. Run the following command to remove users from the recycle bin:
    Import-CSV C:\users-modified.csv | Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin  –Force 
Still need help? Go to Microsoft Community.