Exchange to O365 AutoConfiguration

cindySingh
New Contributor III

Hi, we are moving from Exchange to O365.
When it was exchange, we used @talkingmoose script to conifgure as domain/username. Now we just need to change the username field from DOMAIN/Username to emailaddress@domain.com and we are good.
I tried various way to modify the scirpt but can't.

Anyone has idea how to do it? Only username in Outlook has tobe change from username to email.

Thanks a tonne!
CS

2 REPLIES 2

talkingmoose
Moderator
Moderator

@cindySingh, Outlook currently has a bug where any username field that contains a backslash such as "DOMAINusername" will fail to remove the "DOMAIN" part of the username and leave you with something like "DOMAINuser@domain.com". I've submitted this to Microsoft using Outlook's Insider Fast form, but haven't received a response. Until this is resolved, you can only change the field manually. A script won't work.

If that gets resolved, you can automate this using AppleScript. Be sure to test first because changing the username may very well trigger Microsoft Outlook to empty its email cache and download everything again. That means potentially a lot of network traffic. If that happens, you can't change that behavior. Just be sure you're prepared for that.

The basic command is:

tell application "Microsoft Outlook"
    set emailAddress to email address of exchange account 1
    set user name of exchange account 1 to emailAddress
end tell

Note this command requires the user be logged in to macOS and Outlook be running. If it's not running then it will launch Outlook first. That means, you really want the user to do something to trigger the change. (You don't want to unexpectedly launch Outlook without the user knowing what's happening.)

I suggest putting this in Self Service and having the user click a button to make the change:

#!/bin/sh

currentUser="$3"

su "$currentUser" -c /usr/bin/osascript << 'OUTLOOKCOMMAND'

tell application "Microsoft Outlook"
    set emailAddress to email address of exchange account 1
    set user name of exchange account 1 to emailAddress
end tell

OUTLOOKCOMMAND

"/Library/Application Support/JAMF/bin/Management Action.app/Contents/MacOS/Management Action" -message "Your Microsoft Outlook account has been updated for Office 365." -title "Outlook Update Complete"

buhruce
New Contributor II
@cindySingh, Outlook currently has a bug where any username field that contains a backslash such as "DOMAINusername" will fail to remove the "DOMAIN" part of the username and leave you with something like "DOMAINuser@domain.com". I've submitted this to Microsoft using Outlook's Insider Fast form, but haven't received a response. Until this is resolved, you can only change the field manually. A script won't work.

Unfortunately, this bug still exists.