다음을 통해 공유


IMsgServiceAdmin::CreateMsgService

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.

Adds a message service to the current profile.

HRESULT CreateMsgService(
  LPTSTR lpszService,
  LPTSTR lpszDisplayName,
  ULONG_PTR ulUIParam,
  ULONG ulFlags    
);

Parameters

  • lpszService
    [in] A pointer to the name of the message service to add. This message service name must appear in the [Services] section of the MapiSvc.inf file.

  • lpszDisplayName
    [in] A pointer to the display name of the message service to add. The lpszDisplayName parameter is ignored if the message service has set the PR_DISPLAY_NAME (PidTagDisplayName) property in the MapiSvc.inf file.

  • ulUIParam
    [in] A handle to the parent window of any dialog boxes or windows this method displays.

  • ulFlags
    [in] A bitmask of flags that controls how the message service is installed. The following flags can be set:

    • SERVICE_UI_ALWAYS
      The message service displays its configuration property sheet.

Return Value

  • S_OK
    The call succeeded and has returned the expected value or values.

  • MAPI_E_NOT_FOUND
    The message service name is not in the [Services] section of MapiSvc.inf.

Remarks

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 MapiSvc.inf file contains the list of providers that make up a message service and the properties for each. 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, the values in the 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.

Notes to Callers

CreateMsgService does not return the MAPIUID structure for the message service that was added to the profile.

To retrieve the MAPIUID for the created message service, use the following procedure:

  1. Call the IMsgServiceAdmin::GetMsgServiceTable method to get the message service administration table.

  2. Locate the row that represents the message service by placing a restriction on the table that matches the PR_SERVICE_NAME (PidTagServiceName) property with the name of the message service.

  3. Retrieve the service's PR_SERVICE_UID (PidTagServiceUid) property.

  4. Pass the value of the PR_SERVICE_UID property in the lpUid parameter to the IMsgServiceAdmin::ConfigureMsgService method to configure the service.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MAPIProfileFunctions.cpp

HrAddServiceToProfile

MFCMAPI uses the IMsgServiceAdmin::CreateMsgService method to add a service to a profile.

See Also

Reference

IMsgServiceAdmin : IUnknown

Concepts

MFCMAPI as a Code Sample