by

Export Contacts from a Mailbox Contacts Folder or Public Folder to a CSV file utilizing EWS and REST

Export Contacts from a Mailbox Contacts Folder or Public Folder to a CSV file utilizing EWS and REST As I had a number of questions on exporting contacts to CSV from each Mailbox and Public folders I’ve added some new capabilities to the my EWS contacts module to make this simpler.  I’ve added to new cmdlets the primary is

Export-ContactsFolderToCSV

This may export a contacts folder to CSV’s both the default Contacts Folder in a Mailbox or a secondary Contacts folder if you happen to enter within the FolderPath eg to export the Default contacts Folder use

Export-ContactsFolderToCSV – MailboxName consumer@area.com -FileName c:exportscontacts.csv

To export a Secondary Contacts Folder use

Export-ContactsFolderToCSV – MailboxName consumer@area.com -FileName c:exportscontacts.csv -Folder ContactsSecondContactsFolder

Export-PublicFolderContactsFolderToCSV

This may export a Public Contacts Folder to a CSV file to make use of this use

Export-PublicFolderContactsFolderToCSV -MailboxName mailbox@area.com -FileName c:exportsPublicFolderexport.csv -PublicFolderPath folderfolder2contacts

The EWS Contacts Module is on the market on GitHub right here https://github.com/gscales/Powershell-Scripts/blob/grasp/EWSContacts/EWSContactFunctions.ps1

I’ve additionally added some code to my Exch-REST module to permit export of a Contacts Folder utilizing the brand new REST API on Workplace365 and Trade 2016. To make use of this you want model 2.four of the module from the PowershellGallery https://www.powershellgallery.com/packages/Exch-Relaxation then use

Export-ContactFolderToCSV -MailboxName tmpcontact@area.com -AccessToken $AccessToken -FileName c:exportsfilename.csv