Applies to: Outlook 2013 | Outlook 2016
Returns a MAPIERROR structure that contains information about the previous error.
HRESULT GetLastError( HRESULT hResult, ULONG ulFlags, LPMAPIERROR FAR * lppMAPIError );
[in] A handle to the error code generated in the previous method call.
[in] A bitmask of flags that indicates the format for the text returned in the MAPIERROR structure pointed to by lppMAPIError. The following flag can be set:
The strings should be in Unicode format. If the MAPI_UNICODE flag is not set, the strings should be in ANSI format.
[out] A pointer to a pointer to the MAPIERROR structure that contains version, component, and context information for the error. The lppMAPIError parameter can be set to NULL if there is no error information to return.
The error information was returned.
Either the MAPI_UNICODE flag was set and the implementation does not support Unicode, or MAPI_UNICODE was not set and the implementation supports only Unicode.
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.
Notes to implementers
The details of a remote transport provider's implementation of this method and what messages this method returns are up to the transport provider, because the particular error conditions that lead to various HRESULT values will be different for different transport providers.
Notes to callers
You can use 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 the MAPIFreeBuffer function.
For more information about the GetLastError method, see MAPI Extended Errors.