contacts Property

contacts Property

Ff747407.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 ContactCollection object that contains the user's contact list.

Script:  http://js.live.net/4.1/loader.js
Feature:  Messenger.Core
Namespace:  Microsoft.Live.Messenger
 

// To retrieve:
var contacts = instance.get_contacts();

Return Value

A ContactCollection object that contains the user's complete contact list.

Each user maintains a contact list that appears in the Windows Live Messenger client. The user subscribes to the contacts in this list and, assuming that these contacts have accepted the user into their allow list, the user can receive the presence status of the contacts and send messages to them. These contacts are contained in the ContactCollection object that is returned by this property.

Usually, contacts that appear on the user's contact list are also allowed to see the user's presence status and are therefore also found in the allowedContacts collection.

The following example uses the contacts property to send a predefined message to all of the user's contacts.


            // Get the messenger context and User object. 
            messengerContext = wl.App.get_messengerContext(); 
            user = messengerContext.get_user(); 
            // Get the user's contact list. 
            var userContacts = user.get_contacts(); 
            var contactCid; 
            // Define a message and send it to each contact in the collection. 
            var message = new Microsoft.Live.Messenger.TextMessage("Hello!"); 
            for (i = 0; i < userContacts.get_count(); i++)
            { 
                var contact = userContacts.get_item(i);
                messengerContext.sendMessage(contact.get_cid(), message);
            }
            

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

Show:
© 2016 Microsoft