One of the new requirements for Directory Synchronization in Office 365 is listed in the BPOS to Office 365 Transition guide:
Office 365 requires the User Principal Name (UPN) configured in your directory to precisely match at least one SMTP address configured for that user. If this is not the case, your transition may be delayed until your directory meets this and the other above requirements.
If your organization is transitioning from BPOS, you know that wasn’t the case in BPOS, so may need to update the UPN values on your accounts so Directory Synchronization will work post transition. This script simply sets the UPN value to be equal to the mail attribute on the account.
The first thing you should do is add your Email domains as UPN suffixes in your AD forest, by following this article:
Next, download this VBScript and copy it to your domain controller:
By default when you run the script, it will not make any changes, it will just generate a report of what it would change when you take it out of report mode. After you have reviewed the output and are ready to have the script make changes, change ReportMode=0 in the script.