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

Issue adding Fax and Pager fields to the contacts #89

Open davidsadmin opened 11 months ago

davidsadmin commented 11 months ago

I've been trying to modify the modules in order to add FAX and Pager numbers to the created contacts, but I haven't been able to do it successfully.

Any tips? I tried modifying Get-GALContacts and Sync-ContactList as another issue post suggested to add the homephone, but it's not working for the FAX and pager fields.

grahamr975 commented 4 months ago

@davidsadmin

I've never tested this, but in theory, you should be able to modify the Set-EXCContactObject.ps1 & New-EXCContactObject.ps1 functions to set on the pager & fax on the contact. You'll of course need to pass the pager & fax from the GAL for each user into the script; I'm not sure if the ExchangeOnline "Get-user" command includes the pager. I'm pretty sure you should at least be able to get the fax this way though.

if ($PagerPhone -and $PagerPhone -ne "")
        {
            $Contact.PhoneNumbers[[Microsoft.Exchange.WebServices.Data.PhoneNumberKey]::Pager] = $Pager
        }
if ($BusinessFax -and $BusinessFax -ne "")
        {
            $Contact.PhoneNumbers[[Microsoft.Exchange.WebServices.Data.PhoneNumberKey]::BusinessFax] = $BusinessFax
        }

EWS Contact Phone Types Documentation: https://learn.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.phonenumberkey?view=exchange-ews-api