Implementing a Provider One-Off Table
MAPI calls your provider's IABLogon::GetOneOffTable method when the user of a client application adds a recipient to an outgoing message. Typically, the types of addresses requested are unique to your messaging system. If your provider supports recipient creation, it must supply a one-off table that exposes templates for every type of supported recipient address. If your provider does not support recipient creation, return MAPI_E_NO_SUPPORT from the GetOneOffTable call.
MAPI will typically keep your provider's one-off table open for the lifetime of the session, releasing it only when a client calls either the subsystem's or address book's IMAPIStatus::ValidateState method. MAPI registers for notifications on this table so that if templates are added or deleted, these changes can be reflected to the user.
To implement IABLogon::GetOneOffTable
-
Check the value of the flags parameter, ulFlags. If the MAPI_UNICODE flag is set and your provider does not support Unicode, fail and return MAPI_E_BAD_CHARWIDTH.
-
Check if your provider's one-off table has already been created. Because one-off tables are typically static, your provider never has to go through the creation process more than once. If a table already exists, return a pointer to it.
-
If a one-off table does not yet exist, call CreateTable to create one.
-
Set the following properties for the columns in your table rows:
-
PR_DISPLAY_NAME to the name of the type of recipient that the template can create.
-
PR_ENTRYID to the entry identifier for the one-off template.
-
PR_DEPTH to indicate the hierarchy level in the one-off table display.
-
PR_SELECTABLE to TRUE to indicate if the row represents a template and FALSE otherwise.
-
PR_ADDRTYPE to the type of address created by the template.
-
PR_DISPLAY_TYPE to DT_MAILUSER or another value that indicates the type of display for the template.
-
PR_INSTANCE_KEY to a unique binary value.
-
Call ITableData::HrModifyRow to modify the table directly.
-
Call ITableData::HrGetView to create an IMAPITable interface implementation to return to the caller.