About: Exchange APIs to backup and restore data
Summary:
There limited supported ways to backup and restore data with Exchange programmatically. Backup Supported APIs can backup the data and restore properly. Some developers try using APIs which were not meant for backup up and restoring data in order to gain certain functionality - such approaches usually lead to dead ends such as not being able to overwrite a property is read-only.
Points of Interest:
- Taking the approach of avoiding these supported backup specific APIs and going the route of backup and restore using APIs such as Extended MAPI will not give you full data parity. There are many fields on items in Exchange which are read online and are only written to by the Exchange store.
- Accessing the Exchange database files for direct reading and writing is not supported/not advised. This is something for which developer support cannot be provided for.
- There is no developer support for brick-level backup and restore. A brick-level backup is where each property on an item is read and stored and then the item is recreated property by property during a restore. Support can usually be provided for individual call to read or set a property a property (as would be provided for non-backup software); however, the whole approach is one which should be avoided. Note that not all properties can be set by such applications since some properties can only be set on the store, are calculated properties or were never meant to be set by application code like MAPI, EWS, etc.
- PowerShell can be used automate Exchange backup.
- EWS is not a backup API. However, it does have a way to export an item and load i back with full fidelity through its Export Items and Upload Items calls. Using EWS (or any API) to export MIME and recreate items from MIME is usually bad approach as properties will be lost - i.e. you won't end up with the same item in the end. Keep in mind that Exchange does not store MIME - it generates it on the fly and that processing is server intensive. The same goes for pulling all properties - you never get all properties set when you ask for them, so you won't be able to properly recreate the item later. It is possible to loop try to specify every possible property in with an immense amount of EWS calls, but that's going to either take a very long time - in for a large mailbox the needed calls may not finish until after your retired (half kidding). Keep in mind that asking for MIME and all props are very server expensive calls.
Backgrounders:
With the newer versions of Exchange the supported way to write backup software is to invoke VSS:
About: Exchange VSS Writer - Exchange backup and restore
https://blogs.msdn.com/b/webdav_101/archive/2015/06/01/about-exchange-vss-writer-exchange-backup-and-restore.aspx
The Exchange Backup and Restore API is for older versions of Exchange its not supported with newer versions of Exchange.
About: Exchange Backup and Restore API
https://msdn.microsoft.com/en-us/library/ms878567(EXCHG.65).aspx
Also see:
Backup, restore, and disaster recovery (2013)
https://technet.microsoft.com/en-us/library/dd876874(v=exchg.150).aspx
Using Windows Server Backup to back up and restore Exchange data
https://technet.microsoft.com/en-us/library/dd876851(v=exchg.150).aspx
Troubleshoot your Exchange 2010 database backup functionality with VSSTester script
https://blogs.technet.com/b/exchange/archive/2013/04/29/troubleshoot-your-exchange-2010-database-backup-functionality-with-vsstester-script.aspx
Use the Exchange Management Shell to Determine the Status of Databases
https://technet.microsoft.com/en-us/magazine/dd560707.aspx
Exporting and importing items by using EWS in Exchange
https://msdn.microsoft.com/en-us/library/office/dn672316(v=exchg.150).aspx
My .EDB file grows when I search.
https://blogs.msdn.com/b/webdav_101/archive/2008/07/18/my-edb-file-grows-when-i-search.aspx
HOWTO: Read unmounted Exchange EDB files.
https://blogs.msdn.com/b/webdav_101/archive/2008/09/03/howto-read-unmounted-exchange-edb-files.aspx
Overview of Exchange Server Backup Methods
https://technet.microsoft.com/en-us/library/aa996125(v=exchg.65).aspx#MailboxBrickLevelBackups
Mailbox (Brick) Level Backups
There are several third-party backup programs that can back up and restore individual mailboxes, rather than whole databases. Because those backup solutions do not follow Microsoft backup guidelines and technology, they are not directly supported.
There are known problems with some versions of mailbox-level backup programs including loss of free/busy data and incomplete restores. Every effort is made to help, and to look at the errors and issues that you are having with this type of backup and restore, to determine if there are Exchange problems documented that could cause this error.
About: Messaging APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/08/07/about-messaging-apis.aspx