IMessengerGroups::Remove method

[Remove is no longer available for use as of Windows Vista. See Windows Messenger for more information.]

Removes a MessengerGroup object from a collection.

Syntax

HRESULT Remove(
  [in] IDispatch *pMGroup
);

Parameters

pMGroup [in]

Type: IDispatch*

Pointer to the IDispatch interface on a MessengerGroup object to be removed from the collection.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Success
E_FAIL
Object pointed to by pGroup is not in the collection (as determined locally by the client).
E_POINTER
pGroup is a NULL pointer.
E_NOTIMPL
Cannot be accessed through scripting.
MSGR_E_CANNOT_DELETE
The group "Other Contacts" is read-only and cannot be deleted.
MSGR_E_CONNECT
The client was not logged on.

Remarks

The following table lists the error codes returned by this method.

Error Code Meaning
0x80004001 Cannot be accessed through scripting.
0x80004005 Object pointed to by pGroup is not in the collection (as determined locally by the client).
MSGR_E_CANNOT_DELETE The group "Other Contacts" is read-only and cannot be deleted.
MSGR_E_CONNECT The client was not logged on.

Note

This method is not available for scripting languages.

Examples

The following Visual Basic example shows the use of this method.

Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrGroups As MessengerAPI.IMessengerGroups

Private Sub btnGroupsRemove_Click()
    On Error Resume Next
    FormRemoveGroup.Show vbModal    'Get user input
    If bDialogCancel = False Then   
    Dim found As Long 
        found = FindGroupbyName(strGroupName)   'function to get group by name 
        If found <>  -1 Then
            Set MsgrGroups = Nothing
            Set MsgrGroups = MsgrUIA.MyGroups
            MsgrGroups.Remove MsgrGroups.Item(found)
        Else
            MsgBox("Remove Group: " & strGroupName & "NOTFOUND")
        End If
        populateListView    'Refresh contact list
    End If
    ErrorTrap ("Groups.Remove") 'Error handling routine
End Sub

Requirements

End of client support
Windows XP
End of server support
Windows Server 2003
Header
Msgrua.h
IDL
Msgrua.idl
DLL
Msgsc.dll

See also

IMessengerGroups