Quantcast
Channel: MFCMAPI
Viewing all articles
Browse latest Browse all 1090

New Post: How to get the EMail Address from a contact

$
0
0
Hi Griffin,

I am using following code

//#define PR_EMAIL1_ORIGINAL_DISPLAY_NAME 0x8084001E
void CMapiSession::GetContacts(LPMAPIFOLDER lpFolder)
{
HRESULT         hr              = S_OK;
LPMAPITABLE     lpContentsTable = NULL;
LPSRowSet               sRows = NULL;
enum {ePR_GIVEN_NAME ,                      
    ePR_EMAIL1_ORIGINAL_DISPLAY_NAME ,              
            ePR_BUSINESS_TELEPHONE_NUMBER ,                 
         NUM_COLS};

//These tags represent the message information we would like to pick up
static SizedSPropTagArray(NUM_COLS,sptCols) = { NUM_COLS,
                                                                        PR_GIVEN_NAME ,
                                                                        PR_EMAIL1_ORIGINAL_DISPLAY_NAME ,
                                                                         PR_BUSINESS_TELEPHONE_NUMBER };

hr = lpFolder->GetContentsTable(0, &lpContentsTable);

hr = HrQueryAllRows(    lpContentsTable,
                                 (LPSPropTagArray) &sptCols,
                                NULL,//restriction...we're not using this parameter
                                NULL,//sort order...we're not using this parameter
                                0,
                                &sRows);

for (unsigned int iIndex = 0; iIndex < sRows -> cRows; iIndex++)
{
    //do somethinbg
}
}

After spending couple of hours(reading and debugging MFCMAPI), following is my understanding
  • Since there is no fixed tag for "PR_EMAIL1_ORIGINAL_DISPLAY_NAME"(unlike PR_BUSINESS_TELEPHONE_NUMBER) we can NOT make use of GetContentsTable. Is this understanding right(or is there a workaround)?
  • We need to use GetProps(), and then use GetNamesFromIDs() to solve this problem.
Appreciate your feedback.

Regards,
Rohan

Viewing all articles
Browse latest Browse all 1090

Latest Images

Trending Articles





Latest Images