How to add Microsoft Office Communicator user presence icon to custom page/web part in SharePoint

by James 5/8/2008 6:43:00 PM

James Tsai .Net Blog SharePoint c# VSTO ASP.Net - Microsoft Office Communicator user presence onlin icon

 

In Microsoft.SharePoint.Publishing.WebControls.ConsoleUtilities class you can see this line of code

internal static string GetUserPawnMarkup(string sipAddress, string suffix)

{

    return("<span><img border=\"0\" height=\"12\" src=\"/_layouts/images/imnhdr.gif\" onload=\"IMNRC('" + SPHttpUtility.EcmaScriptStringLiteralEncode(sipAddress) + "')\" ShowOfflinePawn=\"1\" alt=\"\" id=\"MWP_pawn_" + suffix +"\"/></span>");

}

And this is the code used for showing user presence icon in SharePoint site/library/list/item

If you want to have this on your custom .aspx page or web part, you can do it simply by change "sipAdress" with user email address.

<!-- custom .aspx page -->


<%


string userEmail = "james.tsai@local.com";


this.Response.Write("<span><img border=\"0\" height=\"12\" src=\"/_layouts/images/imnhdr.gif\" onload=\"IMNRC('" + userEmail+ "')\" ShowOfflinePawn=\"1\" alt=\"\" id=\"user_presence_icon\"/></span>");


%>

James Tsai .Net Blog SharePoint c# VSTO ASP.Net - Microsoft Office Communicator user presence icon clicked

 

And of course, To get this icon actually working (turn green when user is on) you must have Microsoft Office Communicator installed on client machine.

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

SharePoint

Comments

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen Adopted by James Tsai

About the author

Name of author James Tsai
.NET / SharePoint Consultant
Columbus, OH

E-mail me Send mail

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
View posts in large calendar

Certifications

MCPD
MCTS

Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in