The IABLogon::OpenTemplateID method opens a recipient entry that has data residing in a host address book provider.
See IABLogon : IUnknown.
HRESULT OpenTemplateID(
ULONG cbTemplateID,
LPENTRYID lpTemplateID,
ULONG ulTemplateFlags,
LPMAPIPROP lpMAPIPropData,
LPCIID lpInterface,
LPMAPIPROP FAR * lppMAPIPropNew,
LPMAPIPROP lpMAPIPropSibling
);
The IABLogon::OpenTemplateID method is implemented only by address book providers that need to maintain control over copies of their entries that exist in the containers of host providers. Providers that implement OpenTemplateID are known as foreign address book providers. Host providers call IMAPISupport::OpenTemplateID to create a copied entry or open the copied entry, and MAPI passes on the call to IABLogon::OpenTemplateID. IABLogon::OpenTemplateID opens the entry and binds the code that controls it to data in the host provider.
Rather than use an entry identifier, OpenTemplateID uses another property, the entry's template identifier — PR_TEMPLATEID. Template identifiers should be supported for entries whose code will need to be bound to data in a host provider.
Some examples of when an address book provider should implement IABLogon::OpenTemplateID are:
When a host provider copies or creates an entry from your provider and you supply a property object implementation through IABLogon::OpenTemplateID, you handle most of the calls to maintain the entry. However, because it is up to the host provider to forward these calls to you, the host provider can intercept any call and perform custom processing before forwarding the call.
You should adhere to the following guidelines in your property object implementations:
In general, make your implementation of the entry that you pass back to the host provider intercept all of the methods to perform context-specific manipulation of the relevant properties. If the FILL_ENTRY flag is passed in the ulFlags parameter, set all properties for the entry.
If you return a new property object in the lppMAPIPropNew parameter, call the IUnknown::AddRef method of the host provider's property object to maintain a reference. All calls through the bound object — the IMAPIProp implementation returned in lppMAPIPropNew — should be routed to their corresponding method in the host property object after they are dealt with by the bound object.
The property identifiers of any named properties that are passed through your bound property object are in your provider's identifier name space. Your implementation of the IMAPIProp::GetNamesFromIDs method should determine the names of the properties so that it can perform any template-specific tasks. Similarly, properties that your provider passes on to the host provider must also be in your name space. For example, if you set a named property in OpenTemplateID, you should use one of your identifiers for the name, creating it if necessary by calling GetIDsFromNames.
If you do not recognize the entry identifier passed in lpTemplateID, return MAPI_E_UNKNOWN_ENTRYID.
For more information on working with address book template identifiers, see Acting as a Foreign Address Book Provider.
IMAPISupport::OpenTemplateID, IPropData : IMAPIProp, PR_TEMPLATEID