Using the Messenger API in HTML

I was curious if this was possible. A lot of people want to be able to show presence information in web pages, but don't want to have deploy lots of server controls.

Here is an example showing how to show a count of unread email in your inbox:

<object id="objMessenger" classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28" VIEWASTEXT></object>
<script language="jscript">
function updateUnreadEmail()
{
 spanUnreadEmail.innerHTML=objMessenger.UnreadEmailCount(0);
}
</script>
<span id="spanUnreadEmail"></span>
You'll then need to invoke the updateUnreadEmail() function which you could do in the body's onload event.  This is all client side and can be in any web page.  There is no error handling so it only works if you have Messenger running and signed in, but what this shows is what I wanted to find out which is that it is possible.

This information is not in the MSN Messenger developer center.  The way I found it was to download the Office Communicator Presence Controls.  They install a Messenger APIs help file (CHM file).  There they list all of the methods, properties, events, and, the secret codes, the class IDs.

1 Comment

  • hello westin,



    i tried the above code in my website and i keep getting the following error:

    'objMessenger' is undefined...any ideas what i could be doign wrong?



    thx,

    shiv

Comments have been disabled for this content.