Export (0) Print
Expand All

post Method

Gg262089.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.

Posts a new item to a feed.

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

instance.post(item, callback);

Parameters

item
Type: Object

The new item to create.

callback
Type: DataSaveCompleted

The event handler that is invoked when the POST is completed.

Implements

IDataContextpost(Object, DataSaveCompleted)

The post method allows you to create a new item in a collection without first loading the collection for the data type. The method supports only activities and personal status messages.

The following example demonstrates how to use the post method to add a status activity to an activity collection.

// Ensure the correct scope is set: WL_Activities.Update
function appLoaded(applicationLoadCompletedEventArgs) {
    Microsoft.Live.Core.Loader.load(["microsoft.live.services"], function () {
        var dc = Microsoft.Live.App.get_dataContext();

        // create a status activity
        var activityData = new Microsoft.Live.Services.StatusActivityObject('New status activity...');
        dc.post(new Microsoft.Live.Services.AddStatusActivity([activityData], 'http://www.contoso.com/'), function (dataSaveArgs) {
            var results = dataSaveArgs.get_results();
            if ((results.length != 1) || (results[0].get_resultCode() !== Microsoft.Live.AsyncResultCode.success)) {
                alert('Failed to create new activity: ' + results[0].get_error().message);
            }
            else {
                alert('Success posting new status activity.');
            }
        });
    });
}

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

Show:
© 2014 Microsoft