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.
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
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
Backup, restore, and disaster recovery (2013)
Using Windows Server Backup to back up and restore Exchange data
Troubleshoot your Exchange 2010 database backup functionality with VSSTester script
Use the Exchange Management Shell to Determine the Status of Databases
Exporting and importing items by using EWS in Exchange
My .EDB file grows when I search.
HOWTO: Read unmounted Exchange EDB files.
Overview of Exchange Server Backup Methods
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