HRESULT ReadNamedProperties(LPMESSAGE lpMessage, ULONG ulCount, LPMAPINAMEID *lppTag, LPSPropTagArray *lppPropertyTagArray, LPSPropValue *lppPropertyArray) { HRESULT hr = hrSuccess; ULONG ulReadCount = 0; hr = lpMessage->GetIDsFromNames(ulCount, lppTag, 0, lppPropertyTagArray); if(hr != hrSuccess) { cout << "Failed to obtain IDs from names." << endl; /* * Override status to make sure FAILED() will catch this, * this is required to make sure the called won't attempt * to access lppPropertyArray. */ hr = MAPI_E_CALL_FAILED; goto exit; } hr = lpMessage->GetProps(*lppPropertyTagArray, 0, &ulReadCount, lppPropertyArray); if (FAILED(hr)) { cout << "Failed to obtain all properties." << endl; goto exit; } exit: return hr; }