Adding or Deleting Providers in a Message Service
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
To add or delete service providers in a message service, use the IProviderAdmin : IUnknown interface. You can retrieve an IProviderAdmin pointer by calling IMsgServiceAdmin::AdminProviders. The provider table, accessable through IProviderAdmin::GetProviderTable, lists information about the service providers currently installed in the message service. Clients and service providers can use the provider table to access the name of the provider DLL file, for example, or the MAPIUID, display name, and type of the provider as well as information about the message service. For more information, see Provider Tables.
To add or delete a service provider in a message service
Call the AdminServices method to access a message service administration object.
Call IMsgServiceAdmin::GetMsgServiceTable to access the message service table.
Build a property restriction using an SPropertyRestriction structure that matches PR_DISPLAY_NAME (PidTagDisplayName) or PR_SERVICE_NAME (PidTagServiceName) with the name of the message service to be modified.
Call the message service table's IMAPITable::FindRow method to locate the row in the table that represents the targeted message service.
Call IMsgServiceAdmin::AdminProviders to retrieve an IProviderAdmin pointer. Pass the PR_SERVICE_UID (PidTagServiceUid) column from the message service table row as the lpUID parameter.
Call IProviderAdmin::GetProviderTable to access the provider table.
Build a property restriction using an SPropertyRestriction structure that matches PR_DISPLAY_NAME (PidTagDisplayName) or PR_PROVIDER_DISPLAY (PidTagProviderDisplay) with the name of the service provider to be added or deleted.
Call the provider table's IMAPITable::FindRow method to locate the row in the table that represents the targeted service provider.
Call IProviderAdmin::CreateProvider to add the provider or IProviderAdmin::DeleteProvider to remove it from the message service. For CreateProvider, pass the provider's PR_DISPLAY_NAME property as the lpszProvider parameter. For either method, pass the provider's PR_SERVICE_UID property as the lpUID parameter. After the service provider has been added or deleted, the change will not be apparent until a new session is created.
Another technique for adding a service provider, specifically a message store provider, to a profile involves constructing an entry identifier for the provider. Because constructing an entry identifier requires knowledge of its format, this technique can only be used if the service provider has made its entry identifier format public.
With the newly constructed entry identifier, a client can call IMAPISession::OpenMsgStore. MAPI automatically creates a profile section in the profile for the service provider, but does not add it to a message service.
Some message services do not allow this type of dynamic modification; whether or not it is supported is up to the message service. Another feature that may or may not be supported is the ability to directly access a message service's private profile sections. If the message service you are using permits such access, it will publish the GUID that represents the private section in MAPISVC.INF. You can pass this GUID in a call to IProviderAdmin::OpenProfileSection to access the profile section.