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 Failed to Sync-ContactList #16

Closed choubiket closed 1 year ago

choubiket commented 4 years ago

Hello

I have tried multiple times to use this script but I always face the same issue, no matter the way to connect (classic or Oauth). This is the ERROR message i get :

2020/07/29 15:59:07 INFO Beginning contact sync for XXX@XXX.COM's mailbox EN CLAIR : Chargement du module à partir du chemin « C:\Scripts\GALSync2\EWSContacts\Module\bin\Microsoft.Exchange.WebServices.dll ». EN CLAIR : Using EWS dll from Local Directory EN CLAIR : Using Negotiate Auth PS>Erreur de terminaison (Connect-EXCExchange) : « Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The expected XML node type was XmlDeclaration, but the actual type is Element. » »

Erreur de terminaison (Connect-EXCExchange) : « Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The expected XML node type was XmlDeclaration, but the actual type is Element. » » 2020/07/29 15:59:11 ERROR Failed to Sync-ContactList for XXX@XXX.com Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The expected XML node type was XmlDeclaration, but the actual type is Element. »

I have the exact same error with the previous version of the script, excep with a little more details :

2020/07/29 15:40:39 INFO Beginning contact sync for XXX@XXX.com's mailbox EN CLAIR : Chargement du module à partir du chemin « C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll ». PS>Erreur de terminaison (Connect-EXCExchange) : « Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The expected XML node type was XmlDeclaration, but the actual type is Element. » » 2020/07/29 15:40:41 FATAL Failed verify that CSH exists for XXX@XXX.com Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The expected XML node type was XmlDeclaration, but the actual type is Element. » PS>Erreur de terminaison (Write-Log) : « L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com »

Erreur de terminaison (Write-Log) : « L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com » Erreur de terminaison (Write-Log) : « L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com » Erreur de terminaison (Write-Log) : « L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com » Erreur de terminaison (Write-Log) : « L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com » L’exécution de la commande s’est arrêtée, car la variable de préférence « ErrorActionPreference » ou le paramètre courant a la valeur Stop : Failed verify that CSH exists for XXX@XXX.com Write-Log : Failed verify that CSH exists for XXX@XXX.com Au caractère Ligne:56 : 4

  • Write-Log -Level "FATAL" -Message "Failed verify that $($ ...
  • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
  • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log

I have double checked and rights are fine, impersonation, script, Credentials, etc...

thanks for your feedback !

choubiket commented 4 years ago

Ok, I just tried to launch the script only on one Email, but also using the @OnMicrosoft.com address and this way it works... So :

using toto@mycompany.onmicrosoft.com : OK toot@mycompany.com : KO.

I have checked the Autodiscover on Microsoft URL and everything seems fine...

am i missing something ?

Thanks

grahamr975 commented 4 years ago

Hello,

Could you please upload your error logs in English if possible? I'm having a hard time understanding them. Thank you!

Juergen100 commented 4 years ago

Hi, I got the same error with our domain in the email adress.

2020/08/22 20:49:47 INFO Beginning contact sync for martina.mustermann@xxxx.xx' s mailbox VERBOSE: Loading module from path 'C:\Skripte\EWS-Office365-Contact-Sync\EWSContacts\Module\bin\Microsoft.Exchange.WebServices.dll'. VERBOSE: Using EWS dll from Local Directory VERBOSE: Using Modern Auth VERBOSE: Loading module from path 'C:\Skripte\EWS-Office365-Contact-Sync\EWSContacts\Module\bin\Microsoft.IdentityModel.Clients.ActiveDirectory.dll'.

PS>TerminatingError(Connect-EXCExchange): "Exception calling "AutodiscoverUrl" with "2" argument(s): "The expected XML node type was XmlDeclaration, but the actual type is Element.""

TerminatingError(Connect-EXCExchange): "Exception calling "AutodiscoverUrl" with "2" argument(s): "The expected XML node type was XmlDeclaration, but the actual type is Element."" 2020/08/22 20:49:49 ERROR Failed to Sync-ContactList for martina.mustermann@hey e.de Exception calling "AutodiscoverUrl" with "2" argument(s): "The expected XM L node type was XmlDeclaration, but the actual type is Element."

With xxxxxxx.onmicrosoft.com as domain it works. We have a Exchange hybrid environment with Exchange 2016 server and a Office 365 tenant conneted to 3 AD forest. Autodisvover works fine internal and external, in Exchange Online all accepted domains has the domain type "Internal relay" (except domains that ends with onmicrosoft.com, these are Authoritative). Exchange Online route the emails with domain type "Internal relay" to our On-Premise Exchange 2016 server.

grahamr975 commented 3 years ago

@Juergen100 Thanks for providing this feedback. My environment is Exchange Online. I don't the ability to test in other environments myself at this time.

grahamr975 commented 1 year ago

@choubiket Please try to update to the latest version. Your issue may now be fixed.