Retrieve user id from window live messenger RRS feed

  • General discussion

  • I was using my application to integrated with window live messenger.

    But I cant capture any user id from window live messenger when user log in to msn messenger.

    Please help on this issue. Thanks you very much.

    Wednesday, May 19, 2010 9:01 AM

All replies

  • Hello Asiagis,

    I am not sure the "capture any user id" means.

    If you listen to the "authenticated" event on <msgr:app onauthenticated="onAuthenticated"> tag, the event argument of the handler has a get_user() function that can give you the User object. With the User object in hand, you can get the user's information as well as the user's contacts information.



    Wednesday, May 19, 2010 6:32 PM
  • Hi Lin Wang,

    Thanks for your reply. I mean "capture any user id" is whether I can get any user id (Unique UUID) when log in to window live messenger.

    This is because when i was using for web authentication with web application. The microsoft do provide for UUID but when come to window live messenger then it do not provide for UUID. The reason of having user id (UUID) is beacause I need to identity for the user whose is logging in to my web application via window live messenger.

    Thanks you for your reply. I hope to get any help regard to this issue.

    Thursday, May 20, 2010 1:12 AM
  • Hi Lin Wang,

    Aother thing that I want to ask on how do we call the get_user() in <msgr:app onauthenticated="onAuthenticated"> tag.

    Because there is no instruction on how to call for that function (get_user()).

    Thanks for your help.

    Thursday, May 20, 2010 6:07 AM
  • Hi Asiagis,

      For how to get the User object, please look at another similiar thread where I posted an answer: http://social.msdn.microsoft.com/Forums/en-US/wlmessengerapidev/thread/92cdbc62-f3f7-46e4-ab72-4212006e1244

      We expose both Windows Live ID and CID(A public, unique identifier for a Windows Live ID user) for User/Contact objects.







    Friday, May 21, 2010 12:45 AM
  • Hi anyone,

    I can't get the count for the user contact list with online and offline and to retrieve the user's friend contact list after running the following javascript code on authenticated.

        <!-- Capture for User information -->
        <script type="text/javascript">
        var user = null;
        var userSignIn = null;
        var onlineContacts = [];
        var offlineContacts = [];
        // Handle authentication - sign the user in.
        function onAuthenticated(e) {
           if (e.get_resultCode() == Microsoft.Live.Messenger.AuthenticationResultCode.success) {

              user = e.get_user();
              userSignIn = user.get_identity();
           else {
                alert("not authenticated");

        function signInCompleted(e) {

             if (e.get_resultCode() == Microsoft.Live.Messenger.SignInResultCode.success) {        

                var user_email = user.get_address().get_address();

                // Responsible for updating the onlineContacts array to match
                // the User.OnlineContacts collection.
                onlineContacts = new Array(e.get_user().get_onlineContacts().get_count());
                alert("Count 1 is " + e.get_user().get_onlineContacts().get_count());
                for (var i = 0; i < e.get_user().get_onlineContacts().get_count(); i++) {
                    onlineContacts[i] = e.get_user().get_onlineContacts().get_item(i);

                // Responsible for updating the offlineContacts array to match
                // the User.OfflineContacts collection.
                offlineContacts = new Array(e.get_user().get_offlineContacts().get_count());
                alert("Count 2 is " + e.get_user().get_offlineContacts().get_count());
                for (var i = 0; i < e.get_user().get_offlineContacts().get_count(); i++) {
                    offlineContacts[i] = e.get_user().get_offlineContacts().get_item(i);

                var onlineCount = 0;
                var contacts = e.get_user().get_contacts();
                if (contacts.get_count() != 0) {
                   for (var i = 0; i < contacts.get_count(); i++) {         
                      if (contacts.get_item(i).get_isOnline() == true) {
                          onlineCount += 1;
                <!-- window.location.href = "http://www.agis.sg/msn/lib/userdb.php?user_email=" + user_email; -->
              else {
                   alert("not sign in");

    Can anyone help me on this issue? I have trying to do it since many days. Thanks you very much for your help.

    Wednesday, May 26, 2010 9:49 AM