EWS-Office365-Contact-Sync icon indicating copy to clipboard operation
EWS-Office365-Contact-Sync copied to clipboard

Contact beeing excluded with -ExcludeSharedMailboxContacts if Emailaddress is in capital letters

Open christianneeb opened this issue 2 years ago • 1 comments

Hi,

first of all: Really great job with the script! we run into the problem, that for some human error a couple of users were created with capital letters in their username and therefor in their email address. We can change that username and alias in Exchange and AD no problem, but for some reason the Get-GALContacts.ps1 still shows the email with capital letters. Even after a couple of days, because the GAL is only updated once a day (maybe?).

So after digging into the script i found out i need to alter the following in line 59 Get-GALContacts.ps1. I also added the "HomePhone" attribut in there, because we want to sync those fields also.

$ContactList = $ContactList | Select-Object DisplayName,FirstName,LastName,Title,Company,Department,WindowsEmailAddress,Phone,MobilePhone,HomePhone | Where-Object {$EmailAddressList.Contains($_.WindowsEmailAddress)}

The new one:

$ContactList = $ContactList | Select-Object DisplayName,FirstName,LastName,Title,Company,Department,WindowsEmailAddress,Phone,MobilePhone,HomePhone | Where-Object {$EmailAddressList.Contains($_.WindowsEmailAddress.ToLower())}

Now the scripts creates all the contacts in the user mailbox.

Thanks, Christian

PS: I also added two other features for the script: a) Use an Active Directory Group for selecting the user who receives the contacts in their Outlook and b) Populate the the "HomePhone" and "FileAs" in the created contact. Should i open another "issue" if you are interested?

christianneeb avatar May 04 '22 16:05 christianneeb

@christianneeb

Good work on this. I'll work on fixing the filtering within the main script as time allows.

Regards, Ryan

grahamr975 avatar Jun 29 '22 12:06 grahamr975

This has been fully fixed by commit e6da2a4173219401aa60ecd6aa991916077a9a77

grahamr975 avatar May 30 '23 13:05 grahamr975