The IMAPIProp::GetLastError method returns a MAPIERROR structure containing information about the previous error.
See IMAPIProp : IUnknown.
HRESULT GetLastError(
HRESULT hResult,
ULONG ulFlags,
LPMAPIERROR FAR * lppMAPIError
);
The IMAPIProp::GetLastError method supplies information about a prior method call that failed. Clients can provide their users with detailed information about the error by including the data from the MAPIERROR structure in a dialog box.
All of the implementations of GetLastError provided by MAPI are ANSI implementations except for the IAddrBook implementation. The GetLastError method included with IAddrBook supports Unicode on Windows NT platforms only.
The specifics of a remote transport provider's implementation of this method and what messages this method returns are up to the transport provider, since the particular error conditions which lead to various HRESULT values will be different for different transport providers.
You can make use of the MAPIERROR structure pointed to by the lppMAPIError parameter, if GetLastError supplies one, only if the return value is S_OK. Sometimes GetLastError cannot determine what the last error was or has nothing more to report about the error. In this situation, a pointer to NULL is returned in lppMAPIError instead.
To release the memory for the MAPIERROR structure, call MAPIFreeBuffer.
For more information about the GetLastError method, see Using Extended Errors.