Platform SDK: MAPI

Getting Recipient Details: CMC Sample

The following code example demonstrates how you can look up a specific recipient and get details on that recipient from the address book.

/* Local variables used */

CMC_session_id  Session;
CMC_recipient   *pRecipient;
CMC_recipient   Recip;
CMC_return_code Status;
CMC_uint32      cCount;

/* Look up a name to pick correct recipient. */

Recip.name       = "Bob Weaver";           /* Send to Bob Weaver.     */
Recip.name_type  = CMC_TYPE_INDIVIDUAL;    /* Bob's a person.         */
Recip.address    = NULL;                   /* Look_up Bob's address.  */
Recip.role       = 0;                      /* Role not used           */
Recip.recip_flags      = 0;                /* No flag values          */
Recip.recip_extensions = NULL;             /* No recipient extensions */

Status = cmc_look_up(
              Session,                     /* Session handle          */
              &Recip,                      /* Name to look up         */
              CMC_LOOKUP_RESOLVE_UI |      /* Resolve names using UI. */
              CMC_ERROR_UI_ALLOWED,        /* Display errors using UI.*/
              0,                           /* Default UI ID           */
              &cCount,                     /* Only want one back      */
              &pRecipient,                 /* Returned recipient ptr  */
              NULL);                       /* No extensions           */

/* Display details stored for this recipient. */

Status = cmc_look_up(
              Session,                    /* Session handle           */
              pRecipient,                 /* Name to get details on   */
              CMC_LOOKUP_DETAILS_UI |     /* Show details UI.         */
              CMC_ERROR_UI_ALLOWED,       /* Display errors using UI. */
              0,                          /* Default UI ID            */
              0,                          /* No limit on return count */
              NULL,                       /* No records returned      */
              NULL);                      /* No extensions            */

/* Free the memory returned by the implementation. */

cmc_free(pRecipient);