Diego
Diego

Reputation: 357

C++ MAPI. Manage PR_ENTRYID for Users and Distribution lists

In my C++ application I have an IMAPITable with contacts.

In method 1, I search a contact and get contact properties, such as PR_DISPLAY_NAME_W ir PR_ENTRYID. In method 2, I must receive an ID and I have to open this entry to get another property. For instance, for a contact I will need PR_ADDRTYPE_W and for a distribution list i will need all its members addresses.

Is PR_ENTRYID the best way to indentify a contact/distList (return id in 1) and find easily when required (2)? I supponse it is, since it is an unique value and I see that pAddressBook->OpenEntry() can help me, passing the entryID as parameter.

First, is it correct? Can I find a contact (with the entryId) directly from the addressBook? In my AB I have 10 lists, the contact is in one of them

My problem is that I am not sure how to manage this ID, what to return in method 1 where I have:

pRows->aRow->lpProps[abPR_ENTRYID]

and how to use it in method 2 with the OpenEntry, where I need

    ULONG cbEntryID
    LPENTRYID lpEntryID

hr = pAddressBook->OpenEntry(
  ULONG cbEntryID,
  LPENTRYID lpEntryID,
  LPCIID lpInterface,       // nullptr
  ULONG ulFlags,        // 0L
  ULONG FAR * lpulObjType,
  LPUNKNOWN FAR * lppUnk    // In my case 
);

About returned value (lppUnk), for a contact it is a IMailUser* and for a Distribution List a IDistList*?

I'm afraid i am a bit lost at this moment...

Any help?

Thanks, Diego

Upvotes: 0

Views: 111

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66255

lpulObjType (out) parameter above in your code will tell you what the returned object type is - MAPI_MAILUSER vs MAPI_DISTLIST.

Upvotes: 1

Related Questions