groups Property
Note: |
|---|
| 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. |
Feature: Messenger.Core
Namespace: Microsoft.Live.Messenger
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);
}
}
}
Note: