IMsgServiceAdmin::DeleteMsgService

Applies to: Outlook 2013 | Outlook 2016

Deletes a message service from a profile.

HRESULT DeleteMsgService(
  LPMAPIUID lpuid
);

Parameters

lpuid

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

Return value

S_OK

The message service was deleted.

MAPI_E_NOT_FOUND

The MAPIUID pointed to by lpuid does not match an existing message service.

Remarks

The IMsgServiceAdmin::DeleteMsgService method deletes a message service from a profile. DeleteMsgService removes all profile sections related to the message service.

DeleteMsgService performs the following steps to delete the message service:

  1. Calls the message service's entry point function with the ulContext parameter set to MSG_SERVICE_DELETE before the profile sections are removed. This allows the service to perform any service-specific tasks.

  2. Deletes the message service.

  3. Deletes the message service's profile section.

The message service's entry point function is not called again after the service has been deleted.

Notes to callers

To retrieve the MAPIUID structure for the message service to delete, retrieve the PR_SERVICE_UID (PidTagServiceUid) property column from the message service's row in the message service table. For more information, see the procedure outlined in the IMsgServiceAdmin::CreateMsgService method.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MsgServiceTableDlg.cpp
CMsgServiceTableDlg::OnDeleteSelectedItem
MFCMAPI uses the IMsgServiceAdmin::DeleteMsgService method to delete the selected service.

See also

MAPIUID

IMsgServiceAdmin : IUnknown

MFCMAPI as a Code Sample