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
96 stars 21 forks source link

Error running script #21

Closed rypto closed 3 years ago

rypto commented 3 years ago

Hi, I'm trying to run the script as is with my global admin account on my regular user account, gets the following. You have any tip?

2020-10-12 09:33:43 INFO Beginning contact sync for myname@domain's mailbox VERBOSE: Loading module from path 'C:\scripts\EWS-Office365-Contact-Sync-master\EWSContacts\Module\bin\Microsoft.Exchange.WebServices.dll'. VERBOSE: Using EWS dll from Local Directory VERBOSE: Using Modern Auth VERBOSE: Loading module from path 'C:\scripts\EWS-Office365-Contact-Sync-master\EWSContacts\Module\bin\Microsoft.IdentityModel.Clients.ActiveDirectory.dll'. PS>TerminatingError(New-Object): "A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Exchange.WebServices.Data.OAuthCredentials."

TerminatingError(New-Object): "A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Exchange.WebServices.Data.OAuthCredentials." TerminatingError(New-Object): "A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Exchange.WebServices.Data.OAuthCredentials." 2020-10-12 09:33:44 ERROR Failed to Sync-ContactList for myname@domain.com A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Exchange.WebServices.Data.OAuthCredentials.


Windows PowerShell transcript end End time: 20201012093344


grahamr975 commented 3 years ago
  1. You may need to unblock the included .dll files. To do this, navigate to EWSContacts\Module\bin -> For each .dll file, right-click on the file -> Check 'Unblock'
  2. Global admin is not enough, you also need to give the account application impersonation permissions.
grahamr975 commented 3 years ago

No reply, so I'm closing this issue.