getItem Method

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 item at the specified index in the instance of DataCollection.

Feature:  Microsoft.Live.Services
Namespace:  Microsoft.Live.Services

var liveItem = instance.getItem(index);


Type: Int32

The index location of the item in the collection.

Return Value

The item at the specified index.

The view of the DataCollection uses index values that are in the window of the view. If you request an element that is not loaded yet due to pagination, that is, the item is not in the current view window, the GetItem method throws an exception.

A View provides functionality for client-side pagination and filtering. This is different from the options filter, which specifies server-side filtering.

A view is created for every call to the view property of the DataCollection. Therefore, you should save a view if you plant to reference it again.

For more information, see Data Filtering and Views.

The following example demonstrates how to use the GetItem method in a loop that iterates through a contact collection.

        for (var i = 0; i < contactsCollection.get_length(); i++) {
            var contact = contactsCollection.getItem(i);
            // use the contact


The requested index is not in view.

Windows Live Messenger Connect

Supported in: 4.1

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