Replace to ExchangeContacts Module to assist Trendy Auth,Exporting all Contacts to a VCF file (or CSV) ,NON_IPM root folder,hidden contact folders and dumpster exports

Replace to ExchangeContacts Module to assist Trendy Auth,Exporting all Contacts to a VCF file (or CSV) ,NON_IPM root folder,hidden contact folders and dumpster exports I’ve achieved some updating of my ExchangeContacts PowerShell module to assist the next

  1. Trendy Authentication in Workplace365 (distributing the ADAL dll with this module)
  2. Compiled and distributed the newest model of the EWS Managed API from GitHub with the module
  3. New cmdlet Export-EXCContacts that helps exporting all contacts in a Folder to a single VCF File
  4. New cmdlet Export-EXCContacts that helps exporting all contacts to a CSV file (this was already attainable with the ExportFolder cmdlet however this can be a barely enhanced format)
  5. New cmldet Export-EXCRootContacts helps you to export the Non_IPM Subtree folders that include contacts. (A few of these are created by the Workplace365 substrate course of) for instance mycontacts, AllContacts, ContactSearch folders and many others. Embody dedup code primarily based on Electronic mail Tackle on this cmdlet
  6. That is already supported however I wished to indicate how one can export the Hidden Contacts Folder likes Recipient Cache, Gal and Organizational Contacts
  7. New cmdlet Get-EXCDumpsterContacts get the contacts which are within the RecoverableItems Deletions or Purges Folder
  8. New cmdlet Export-EXCDumpsterContacts Exports the contacts which are within the RecoverableItems Deletions or Purges Folder to a single VCF or csv file


Utilizing Trendy Authentication

As Primary Authentication in EWS goes away quickly in Workplace365 I’ve enabled Trendy Auth for this module utilizing the ADAL dll which will get distributed through the bin listing within the Module. I did not enabled it by default as a result of it might trigger points with OnPrem Trade so to make use of Trendy Auth you simply want to make use of the -ModernAuth swap. You’ll be able to nonetheless cross within the PSCredential object with the -ModernAuth swap and oAuth will nonetheless be used vai the username and password grant to permit for silent auth. There’s additionally provision to cross in your personal consumer id for customized app registrations with the -ClientId parameter eg a easy instance for utilizing ModernAuth is 


Get-EXCContact -MailboxName gscales@datarumble.com
-EmailAddress what@what.com -ModernAuth

Export-EXCContacts

Export-EXCContacts helps exporting all of the contacts from any folder in a Mailbox to a single VCF file or a CSV File. (EWS supplies the VCF nativly for Mailbox contacts so this cmlet hanldes streaming them out to a single file). Eg listed below are some examples

Exporting to a single VCF

Export-EXCContacts -Folder "Contacts" -MailboxName gscales@datarumble.com
-ModernAuth -FileName c:tempexp.vcf

or to a CSV


Export-EXCContacts -Folder "Contacts" -MailboxName gscales@datarumble.com
-ModernAuth -FileName c:tempexp.csv -ExportAsCSV

Export-EXCRootContacts

Export-EXCRootContacts helps exporting contacts from the NON_IPM_Subtree folders in a Mailbox. Usually folders listed below are created by both a Shopper like Outlook or OWA, different Workplace365 substrate course of (eg Microsoft Groups) or different third celebration apps the place they need the info to be hidden from the person. Examples of those folders can be Allcontacts, mycontacts and many others. I’ve added this extra for instructional and diag functions and Included some dedup code to deduplicate exports primarily based on the EmailAddress. An instance of export the AllContacts Folder to a CSV file

Export-EXCRootContacts -MailboxName gscales@datarumble.com -FolderName AllContacts -FileName c:tempallContacts.csv
-ExportAsCSV -ModernAuth


Get-EXCDumpsterContacts

This cmdlet will question both the RecoverableItemsDeletions or RecoverableItemsPurges folders in a Mailbox (Dumpster v2 folder) and it’ll get any contacts that exist in these folders and return them as EWSContact objects. (You’ll be able to then course of them additional eg copy,transfer and many others)

eg


Get-EXCDumpsterContacts -MailboxName gscales@datarumble.com -ModernAuth -Purges

or purges


Get-EXCDumpsterContacts -MailboxName gscales@datarumble.com -ModernAuth 
Export-EXCDumpsterContacts


This cmdlet builds on Get-EXCDumpsterContacts and lets you export what’s returned to both a single VCF file or a CSV file. (similar logic as Export-EXCContacts)


Export-EXCDumpsterContacts -MailboxName gscales@datarumble.com -ExportAsCSV
-FileName c:tempdumpsterDeletions.csv

or purges

Export-EXCDumpsterContacts -MailboxName gscales@datarumble.com -purges -ExportAsCSV
-FileName c:tempdumpsterPurges.csv



Exporting  hidden Contacts folders

One last item I wished to show with this module is the power to export the Hidden contact folders in your mailbox, when you have ever peeked on the Contacts folder subfolder hierarchy in a MAPI editor like MFCmapi there are a selection of Hidden folders eg

Folders like Recipient Cache, Gal Contacts and Organizational Contacts folder all serve completely different consumer particular duties (that do go mistaken generally). So you need to use this module to export the contacts in these folders to a CSV for any troubleshooting, migration or private curiosity wants.

Listed below are some examples of exporting contacts from these folders to a csv file


Export-EXCContacts -Folder "ContactsOrganizational Contacts"
-MailboxName gscales@datarumble.com -ModernAuth -FileName c:tempexp.csv
-ExportAsCSV

The brand new module might be discovered on the Powershell Gallery https://www.powershellgallery.com/packages/ExchangeContacts/1.6.0.0 and the supply is on the market right here on GitHub https://github.com/gscales/Powershell-Scripts/tree/grasp/EWSContacts/Module

Leave a Reply