Activity Class

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.

Represents the base class for activity-related resource classes.

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

The JavaScript Library for Windows Live Messenger Connect is built by using the Microsoft Ajax Library. Microsoft Ajax exposes a type system that enables you to add object-oriented capabilities to your JavaScript code. To learn more about creating, instantiating, and deriving from classes, see Creating Custom Client Script by Using the Microsoft Ajax Library.

Microsoft.Live.Services.Activity = function();


An activity is a top-level resource type that is accessible in Windows Live Services. The resource type encapsulates information about an activity that might appear in an activity listing or stream. The Activity class is a base class that represents a programmatic view of an activity. The class provides methods to get and set properties of the activity, and supports saving changes to the activity.

For more information about the activity resource and resources in general, see Windows Live Resource Model. For more information about working with activities, see Working with Activities (JavaScript).

To read activities from Windows Live, use the wl_Activities_View scope. When you request activities for an authenticated user, you receive an object of class ActivityCollection, which is a collection of Activity objects. The type of activities returned depends on what field of the DataType class was specified for the fetch operation:

  • If the myActivities field of the DataType class is specified, all of the authenticated user's activities are shown, regardless of where the activities were created.

  • If the contactsActivities field of the DataType class is specified, certain activities are shown: activities from the user's contacts that were created by the current application, and activities from contacts created by Windows Live UI, such as Messenger. Activities created by other applications are not shown.

Each activity exposes properties that define the activity. The following are the key properties:

  • htmlSummary provides a summary of the activity with active links either to the user who created the activity or to the content referenced in the activity.

  • htmlContent provides the content of the activity, and is more detailed then the htmlSummary.

  • title is the same as htmlSummary except with no active links.

  • activityType enables you to quickly determine the activity's type.

To add activities to Windows Live, use the wl_Activities_Update scope. For more information about scopes, see Messenger Connect Scopes. In typical scenarios, you work with classes that derive from the Activity class, such as AddBookmarkActivity or MarkFavoriteActivity.

Because properties may return undefined, you should check the values returned from properties of an Activity object to make sure that the values are appropriate for presentation in a user interface. Furthermore, when you create a new activity such as AddBookmarkActivity that derives from the Activity class, many of the properties of the base class are not defined. They are only defined when the activity is read from a Windows Live endpoint.

The following example demonstrates how to create and post a status activity to Windows Live using the AddStatusActivity class, which derives from the Activity class.

function addBookmarkActivity() {
    if (myActivitiesCollection) {
        var targetLink = '';
        var title = 'a bookmark' + new Date();
        var description = 'a favorite site';
        var bookmarkActivityObject = new Microsoft.Live.Services.BookmarkActivityObject(targetLink, title, description);
        var bookmarkActivity = new Microsoft.Live.Services.AddBookmarkActivity([bookmarkActivityObject], '');
        var applicationLink = '';
        if (bookmarkActivity.validateParams([bookmarkActivityObject], '')) {


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