grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
94 stars 21 forks source link

-ExcludeSharedMailboxContacts, uses HiddenFromAddressListsEnabled, not RemoteRecipientType #59

Open Snake98bm opened 1 year ago

Snake98bm commented 1 year ago

when I suggest a fix in [https://github.com/grahamr975/EWS-Office365-Contact-Sync/issues/58], i didn't follow the code and later discovered that it only look at the HiddenFromAddressListsEnabled property, that had nothing to-do with shared mailboxes.

On the file GET-Gal-Contacts.ps1 line 64 I suggest following change.

DirectoryList = $(Get-EXOMailbox -ResultSize unlimited -PropertySets Minimum,AddressList | Where-Object {($_.HiddenFromAddressListsEnabled -Match "False") -and ($_.RecipientTypeDetails -notmatch "SharedMailbox")} )

This will keep backward compatibility, but also filter all shared-mailboxes.

grahamr975 commented 1 year ago

I should really separate these into different flags, such as "-ExcludeHiddenMailboxContacts" and "-ExcludeSharedMailboxContacts". I'll look into this and get back to you.

Snake98bm commented 1 year ago

That would provably be best.

rypto commented 1 year ago

Hi! Has this been implemented yet? two separate flags?