Last modified: July 23, 2011

Applies to: Outlook

Copies a message service into a profile.

HRESULT CopyMsgService(
  LPSTR lpszDisplayName,
  LPCIID lpInterfaceToCopy,
  LPCIID lpInterfaceDst,
  LPVOID lpObjectDst,
  ULONG_PTR ulUIParam,
  ULONG ulFlags


[in] A pointer to the MAPIUID structure that contains the unique identifier of the message service to copy.


[in] This parameter has been deprecated.


[in] A pointer to the interface identifier (IID) that represents the interface to be used to access the profile section of the message service to copy. Passing NULL results in the standard profile section interface, IProfSect, being used.


[in] A pointer to the IID that represents the interface to be used to access the object pointed to by the lpObjectDst parameter. Passing NULL results in the session interface, IMAPISession, being used. The lpInterfaceDst parameter can also be set to IID_IMsgServiceAdmin.


[in] A pointer to a pointer to a session or message service administration object. The type of object should correspond to the interface identifier passed in lpInterfaceDst. Valid object pointers are LPMAPISESSION and LPSERVICEADMIN.


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


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


Requests that the message service always display a configuration property sheet.


The message service was successfully copied.


The message service is already in the profile and does not allow multiple instances of itself.


The MAPIUID pointed to by lpUID does not refer to an existing message service.

The IMsgServiceAdmin::CopyMsgService method copies a message service into a profile, either the active profile or another profile. The profile that contains the message service to be copied and the destination do not have to be the same profile, but they can be.

The message service's entry point function is not called for a copy operation. The copied message service has the same configuration settings as its original. To change these settings, a client should call the IMsgServiceAdmin::ConfigureMsgService method.