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.

Be the first to rate this post

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

Tags: , , ,

SharePoint

Comments

Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading



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 and SharePoint consultant

E-mail me Send mail

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567
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 2008

Sign in