Platform SDK: MAPI |
The following code example demonstrates how you can specify use of the common extensions during a session logon.
/* Local variables used */ CMC_return_code Status; CMC_session_id Session; CMC_extension Extension; CMC_extension Extensions[10]; /* show how to handle multiple */ CMC_X_COM_support Supported[2]; CMC_uint16 index; CMC_boolean UI_available; /* Find out if the common extension set is supported, but COM_X_CONFIG_DATA support is not required. */ Supported[0].item_code = CMC_XS_COM; Supported[0].flags = 0; Supported[1].item_code = CMC_X_COM_CONFIG_DATA; Supported[1].flags = CMC_X_COM_SUP_EXCLUDE; Extension.item_code = CMC_X_COM_SUPPORT_EXT; Extension.item_data = 2; Extension.item_reference = Supported; Extension.extension_flags = CMC_EXT_LAST_ELEMENT; Status = cmc_query_configuration( 0, /* No session handle */ CMC_CONFIG_UI_AVAIL, /* See if UI is available. */ &UI_available, /* Return value */ &Extension); /* Pass in extensions. */ /* Error handling */ if (Supported[0].flags & CMC_X_COM_NOT_SUPPORTED) return FALSE; /* Needed common extensions are not available. */ /* Log onto system and get the data extensions for this session. */ Supported[0].item_code = CMC_XS_COM; Supported[0].flags = 0; Supported[1].item_code = CMC_X_COM_CONFIG_DATA; Supported[1].flags = CMC_X_COM_SUP_EXCLUDE; Extension.item_code = CMC_X_COM_SUPPORT_EXT; Extension.item_data = 2; Extension.item_reference = Supported; Extension.extension_flags = CMC_EXT_REQUIRED | CMC_EXT_LAST_ELEMENT; Status = cmc_logon( NULL, /* Default service */ NULL, /* Prompt for user name. */ NULL, /* Prompt for password. */ NULL, /* Default character set */ 0, /* Default UI ID */ CMC_VERSION, /* Version 1 CMC calls */ CMC_LOGON_UI_ALLOWED | /* Full logon UI */ CMC_ERROR_UI_ALLOWED, /* Use UI to display errors. */ &Session, /* Returned session ID */ &Extension); /* Logon extensions */ /* Error handling */ if (Supported[0].flags & CMC_X_COM_NOT_SUPPORTED) return FALSE; /* Needed common extensions are not available, */ /* the common data extensions will be used for this session. */ /* Example of how to free data returned from the CMC implementation in function output extensions. */ for (index = 0; 1; index++) { if (Extensions[index].extension_flags & CMC_EXT_OUTPUT) { if (cmc_free(Extensions[index].item_reference) != CMC_SUCCESS){ /* Handle unexpected error here. */ } } if (Extensions[index].extension_flags & CMC_EXT_LAST_ELEMENT) break; } /* Do various CMC calls. */ /* Log off from the implementation. */ Status = cmc_logoff( Session, /* Session ID */ 0, /* No UI will be used. */ 0, /* No flags */ NULL); /* No extensions */ /* Error handling */