Share via


IMessenger2::CreateGroup Method

Deprecated. Creates a new group to the MessengerGroups collection object.

Syntax

HRESULT CreateGroup(      
    BSTR bstrName,
    VARIANT vService,
    IDispatch **ppGroup
);

Parameters

  • bstrName
    [in] A BSTR that specifies the name of the group to be created.
  • vService
    [in] A VARIANT that can take as its value either a VT_BSTR string or a VT_DISPATCH pointer to an existing MessengerService object.
  • ppGroup
    [out, retval] Return value. Pointer to a pointer to an IDispatch World Wide Web link interface.

Return Value

Returns one of the following values:

S_OK Success.
MSGR_E_GROUPS_NOT_ENABLED Client has not enabled groups, or the current service does not support groups.
MSGR_E_GROUP_NAME_TOO_LONG The new name of the group exceeds the maximum number of characters.
MSGR_E_BAD_GROUP_NAME The new name of the group is invalid. Characters such as carriage returns, linefeeds, tabs, and nonprintable characters are not allowed. Spaces before and after the group name will be trimmed automatically.
E_INVALIDARG

bstrName or vService (if VT_BSTR) is a NULL string or contains nothing but spaces.

- or -

vService (if VT_BSTR) exceeds the maximum number of characters.

- or -

bstrName or vService (if VT_BSTR) contains a carriage return or linefeed.

RPC_X_NULL_REF_POINTER ppGroup is a NULL pointer.
MSGR_E_NOT_LOGGED_ON Client was not signed in to the primary service at the time this method was called.
E_POINTER bstrName is NULL.

Remarks

Some services, such as Microsoft Exchange Instant Messaging Service (IM), do not support groups. Using this method on these services will return the error, MSGR_E_GROUPS_NOT_ENABLED.

The IMessenger2::CreateGroup method will look for a group name (bstrName) in the local user list of groups for the service (vService). If not found, the method will attempt to create a new group. To check the success of the creation of a new group, use DMessengerEvents::OnGroupAdded.

The service parameter (vService) can be a string that contains the service ID, not the name, of the service. The service ID can be obtained from IMessenger::MyServiceId for the primary service or from IMessengerServices::PrimaryService or IMessengerContact::ServiceID.

Note  This method is not available for scripting languages.

Important  IMessenger2::CreateGroup is no longer available in Windows Vista. See Windows Messenger for more information.

See Also

IMessengerGroups