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

Only contacts with MobilePhone #86

Closed DanielRonies closed 10 months ago

DanielRonies commented 11 months ago

Good morning, mine is not a problem, it's a question about how to modify the script to achieve this.

I want to only synchronize the accounts that have the field "MobilePhone" set to true. Currently, I know it includes the fields "Phone" or "MobilePhone," but I only want the latter.

Thank you very much.

Regards.

grahamr975 commented 10 months ago

You want to modify Get-GalContacts.ps1, line 78 & use the ExcludeContactsWithoutPhoneNumber switch. OLD $ContactList = $ContactList | Where-Object {$_.Phone -or $_.MobilePhone}

NEW $ContactList = $ContactList | Where-Object {$_.MobilePhone}