The case of the mailbox validation error

Today I noticed a strange warning when opening a mailbox:

WARNING: The object domain.local/Productie/Users/SomeOU/LoaderA0001 has been corrupted, and it's in an inconsistent state. The following validation errors happened:
WARNING: Property expression "LoaderA0001" isn't valid. Valid values are: Strings that includes '@', where '@' cannot be the last character

 

It complains about the @ sign being an invalid character, but it’s not in there!

I opened PowerShell and used the Validate method off the Mailbox object and this gave a more precise error:

Constraint         : Microsoft.Exchange.Data.RegexConstraint
InvalidData        : LoaderA0001
PropertyDefinition : UserPrincipalName (System.String)
Description        : Property expression "LoaderA0001" isn't valid. Valid values are: Strings that includes '@', where '@' cannot be the last character
PropertyName       : UserPrincipalName

 

So it appeared to be a problem with the userPrincipalName attribute, I first changed it through the Exchange Management Shell but I got the same error there.

Then I opened the object with ADSI Edit and cleared the value of userPrincipalName:

image

Then I set the correct value using the Exchange Management Shell and that made everybody happy again!