Returns the error number of the last MAPI call. If the last MAPI call was successful - 0 will be returned.
Mapi.bdh
MapiGetLastError() : number;
See MAPI Sample