This documentation is archived and is not being maintained.

IMessenger2::MyGroups

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Retrieves the Group list contained in the Messenger object. The retrieved list is a MessengerGroups collection object that can be manipulated by the IMessengerGroups interface. Not scriptable.


HRESULT MyGroups(
   [out,
   retval] IDispatch** ppMGroups
);

ppMGroups

Return value. Pointer to a pointer to an IDispatch interface. In practice, this returns the IMessengerGroups interface on the contact list or MessengerGroups collection object.

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.

S_OK

Success.

E_OUTOFMEMORY

An error occurred during the list creation.

RPC_X_NULL_REF_POINTER

ppMGroups is a null pointer.

MSGR_E_GROUPS_NOT_ENABLED

The current service does not support groups.

ppMGroups should be released when it is no longer needed. Retrieved lists can potentially have zero members in their collection.

If this property is called while the client is not signed in, the HRESULT is S_OK and a true object is returned. However, the resulting MessengerGroups collection object will have zero members (that is, it contains no valid MessengerGroups objects).

The following example code instantiates an IMessengerGroups object, calls the IMessenger2::MyGroups method on communicator, the Messenger Cocreatable object, and iterates over the collection of IMessengerGroup objects to display the group name on the application console. For more information about the IMessengerGroup interface, see IMessengerGroup.

if (communicator != null)
{
   IMessengerGroups myGroups;
   try
   {
       myGroups = (IMessengerGroups)communicator.MyGroups;
       if (myGroups != null)
       {
          foreach (IMessengerGroup myGroup in myGroups)
          {
              Console.WriteLine("Group: " + myGroup.Name);
          }
       }
   }
   catch (COMException CGCE)
   {
      Console.WriteLine(CGCE.ErrorCode.ErrorCode.ToString());
   }
}

Client

Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .

Server

Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.

Product

Microsoft Office Communicator 2007 Automation API

IDL file

Msgrua.idl

Show: