The IMsgServiceAdmin::CreateMsgService method adds a message service to the current profile.
See IMsgServiceAdmin : IUnknown.
HRESULT CreateMsgService(
LPTSTR lpszService,
LPTSTR lpszDisplayName,
ULONG ulUIParam,
ULONG ulFlags
);
The IMsgServiceAdmin::CreateMsgService method adds a message service to the current profile. CreateMsgService calls the message service's entry point function to perform any service-specific configuration tasks. If the SERVICE_UI_ALLOWED flag is set in the ulFlags parameter, the message service being installed can display a property sheet to enable the user to configure its settings.
The list of providers that make up a message service and the properties for each are contained within the MAPISVC.INF file. CreateMsgService first creates a new profile section for the message service and then copies all of the information for that service from the MAPISVC.INF file into the profile, creating new sections for each provider.
After all the information has been copied from MAPISVC.INF, the message service's entry point function is called with the MSG_SERVICE_CREATE value set in the ulContext parameter. If the SERVICE_UI_ALLOWED flag is set in the CreateMsgService method's ulFlags parameter, then the values in the CreateMsgService ulUIParam and ulFlags parameters are also passed when the message service's entry point function is called. Service providers should display their configuration property sheets so users can configure the message service.
CreateMsgService does not return the MAPIUID for the message service added to the profile.