This topic has not yet been rated - Rate this topic

groups Property

Ff748083.note(en-us,MSDN.10).gifNote:
Current information about Live Connect is now available in the Windows Live Developer Center. The information in the following sections is provided for legacy purposes only.

Gets the GroupCollection object that contains all of the user's groups.

Script:  http://js.live.net/4.1/loader.js
Feature:  Messenger.Core
Namespace:  Microsoft.Live.Messenger
 
// To retrieve:
var groups = instance.get_groups();

Return Value

A GroupCollection object that contains all of the groups that have been defined by the user.

Groups enable users to organize their contacts. Each Group object contains a collection of IMAddress objects that the user has assigned together.

The following code example detects when a group is added and verifies that the name is valid.


            // Get the messenger context and the User object. 
            messengerContext = wl.App.get_messengerContext(); 
            user = messengerContext.get_user(); 
            // Define a handler that detects when the User's groups are changed. 
            user.get_groups().add_collectionChanged(groupsCollectionChanged); 
            
            function groupsCollectionChanged(sender, args)
            { 
                //If the names of the new groups are invalid, remove them from the list and display an alert to the user. 
                newGroups = args.get_newItems(); 
                for (var i=0; i <  newGroups.get_count(); i++) 
                { 
                    if(newGroups(i).isNameValid() == true)
                    { 
                        alert("The group name " + newGroups(i).get_name() + " is not valid."); 
                        user.get_groups().remove(newGroups(i); 
                    } 
                } 
            }
            

Windows Live Messenger Connect

Supported in: 4.1

Windows Live Messenger Web Toolkit

Supported in: 3.7, 3.5, 3.1, 3.0, 2.5, 2.0, 1.0

Internet Explorer 8.0, Internet Explorer 7.0, Internet Explorer 6.0, Firefox 3.6, Firefox 3.5, Firefox 3.0, Firefox 2.0, Firefox 1.5, Chrome 4.0, Chrome 3.0, Chrome 2.0, Chrome 1.0, Safari 4.0, Safari 3.0, Opera 10.5

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.