SOLVED
Home

Exchange Online - Extract user's contacts with PS

Jaap Hoetmer
New Contributor

Hi all,

 

I have spent a fair amount of time trying to find a Powershell script enabling me to extract the contacts of an O365 Exchange account to a local file. It has proven to be somewhat of a challenge.

 

I found this script https://gallery.technet.microsoft.com/office/How-to-export-a-mailboxs-2dd7247a, which upon first observation should be able to produce what I want, but the script doesn't work, it fails indicating an Autodiscover error.

 

C:\Scripts\EXOGetContacts.ps1 : The Autodiscover service returned an error.
Au caractère Ligne:1 : 1
+ .\EXOGetContacts.ps1
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [EXOGetContacts.ps1], AutodiscoverRemoteException
    + FullyQualifiedErrorId : AutodiscoverRemoteException,EXOGetContacts.ps1

 

Does anyone have any suggestions, either for the above error, or for an alternative methode to extract contacts using Powershell?

 

Much appreciated, kind regards.

2 Replies
Solution

The script seems to have some undefined variables, and thus fails to connect. You can put something like this:

 

$exchangeService.Url = "https://outlook.office365.com/EWS/Exchange.asmx"

 

I'd recommend using Glen's EWSContacts module for any Contacts related operations: https://github.com/gscales/Powershell-Scripts/tree/master/EWSContacts

Hi Vasil,

 

Thanks for your suggestion, it turned out to be a problem with autodiscovery not finding the correct URL, the suggestion you gave by bypassing autodiscovery works. I'll try to understand why it doesn't work using Autodiscovery.

 

I'll also give Glen's EWSContacts script a try.

 

Much appreciated, kind regards,

Jaap

Related Conversations
Dont see any Contact in Teams
nicb in Microsoft Teams on
2 Replies
Outlook (365) Need Password - Issue
Muhammad Ali Khan in Office 365 on
20 Replies
Accessing a shared mailbox from a mobile device
Hexsysadmins in Office 365 on
14 Replies
Reporting on Project Online (PWA) Timesheets
Andy Dennis in Project on
3 Replies