Welcome to MSDN Blogs Sign in | Join | Help

How to add presence/pawn to SharePoint contacts list

I have often been asked to add the presence icon and functionality to custom developed web parts or SharePoint pages. As you are probably aware this is a very simple thing to do, the secrect lies in calling the IMNRC jscript function passing in an email address in the rendered html. e.g. IMNRC('administrator@somewhere.com'). You don't really need to know, or probably don't care how this actually works behind the scenes, so in summary; the IMNRC function calls an ActiveX control (called "name.dll") on the users machine which does the work, this control is installed with Office 2003. So developing web parts of custom SharePoint web pages with presence support added is pretty easy.

However, recently I had the requirement to show presence info on the email address field in the out of the box contacts list for WSS sites. I am not 100% sure why this feature was not added by the product team, but I guess it's because your contact list may have email addresses from users outside of your organisation and hence the presence information wouldn't make much sense. Anyway, I set myself the challenge of adding this. In theory it is not that difficult, you need to modify the CAML in the schema.xml for the contacts list to change the HTML that is rendered for the allitems view, i.e. inject the IMNRC function call for the email address field. In theory easy, in practice a little bit of a pain. I have therefore attached the sample CAML that I used in schema.xml for the contacts list. This is the viewbody section in the all contacts view i.e. <View BaseViewID="1">. Remember, this is sample code that you must test fully before deploying. Good luck!

<!-- for each field, if the field is called e-mail then spit out the imnrc function with the raw email address-->

<ViewBody>
    <HTML><![CDATA[<TR>]]></HTML>
    <Fields>
        <HTML><![CDATA[<TD Class="]]></HTML>
   <FieldSwitch>
   <Expr>
    <Property Select="ClassInfo" />
   </Expr>
   <Case Value="Menu">
    <HTML>
     <![CDATA[ms-vb-title" height="100%]]></HTML></Case>
   <Case Value="Icon">ms-vb-icon</Case>
   <Default>
    <FieldSwitch>
     <Expr><Property Select="Type" /><PresenceEnabled /> </Expr>
     <Case Value="UserTRUE">ms-vb-user</Case>
     <Default>
      <FieldSwitch>
      <Expr>
       <Property Select="Name" />
      </Expr>
      <Case Value="Email">ms-vb-user</Case>
      <Default>ms-vb2</Default>
     </FieldSwitch>
     </Default>
    </FieldSwitch>
   </Default>
  </FieldSwitch>
        <HTML><![CDATA[">]]></HTML>
        <FieldSwitch> <Expr><Property Select="Name"/></Expr>
   <Case Value="Email">
           <HTML><![CDATA[<table cellpadding="0" cellspacing="0" ID="Tbl_]]></HTML>
           <ID/>
           <HTML><![CDATA["><tr><td style="padding-right: 3px;"><img border="0" valign="middle" height="12" width="12" src="/_layouts/images/blank.gif" onload="IMNRC(']]></HTML>
           <Column />
           <HTML><![CDATA[')" id="mnid]]></HTML>
           <ID/>
           <HTML><![CDATA["></td><td style="padding-top: 1px;" class="ms-vb"> ]]></HTML>
          <Field/>
          <HTML><![CDATA[</td></tr></table>]]></HTML>
   </Case>
         <Default><Field/></Default>
        </FieldSwitch>
        <HTML><![CDATA[</TD>]]></HTML>
    </Fields>
    <HTML><![CDATA[</TR>]]></HTML>
</ViewBody>

Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

Published Wednesday, May 11, 2005 4:57 AM by modonovan

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Mr Michael O'Donovan in the Blogoshpere...

Wednesday, May 18, 2005 12:37 PM by Point2Share
Well this is welcome news (Thanks Mr. Bower, seems Michael doesn&amp;rsquo;t talk to me anymore), another...

# re: How to add presence/pawn to SharePoint contacts list

Thursday, August 04, 2005 4:15 PM by thorneb0b
I'm really interested in using this feature for our firm's electronic In/Out board. Do you have any additional advice or code examples of how to use the IMNRC feature? We have a SQL table with all of our staff (email, phone extension, etc.), and would like to tie this table to the IMNRC in a SPS/WSS page. Any examples or advice would be greatly appreciated, and we could discuss some compensation for coding work. I can be reached at rthorne@ssandg.com for more details

# re: How to add presence/pawn to SharePoint contacts list

Thursday, August 04, 2005 9:03 PM by modonovan
That is very possible. Essentially you need to emit HTML in your web part calls the IMNRC function around the email address e.g. IMNRC(administrator@somewhere.com'). For a good example, add the members web part to the page and then view the page source in your browser.

# re: How to add presence/pawn to SharePoint contacts list

Friday, March 10, 2006 2:39 PM by BobC
Based on the info on the following page:
http://www.ideseg.com/CategoryView,category,SharePoint-es.aspx

I added the following to my dvwp list:
                               <span>
                                   <img border="0" valign="middle" height="12" width="12" src="/_layouts/images/blank.gif" onload="IMNRC('{@Email}')" id="imn{ddwrt:Counter()}" ShowOfflinePawn=1 />
                               </span>

# re: How to add presence/pawn to SharePoint contacts list

Tuesday, March 21, 2006 8:39 AM by BobC
Any idea why Frontpage modifies calls to {ddwrt:Counter()} to (generate-id}

This breaks the imnrc functionality when I use it in more than one web part on a page.

# Viewing new SharePoint 2007 sites with IE7

Wednesday, October 18, 2006 6:45 PM by Fear and Loathing

Just a little tip as I finally crossed over to the dark side and installed the latest version ofIE7.

# SharePoint 2007 Features Projekt auf GotDotNet

Friday, January 26, 2007 7:42 AM by SharePoint, SharePoint and stuff

Scott Hillier organisiert auf GotDotNet ein Projekt SharePoint 2007 Features das sich zum Ziel gesetzt

# Useful and (free!) SharePoint "Features" available at http://www.CodePlex.com/Features

Occasionally, I ask SharePoint professionals, who have done interesting and useful work to post a guest

# Changing the theme when a new SharePoint 2007 site is created. &laquo; An Posts

# Become Presence Aware with your WebParts with just an email!

Wednesday, September 19, 2007 4:12 PM by ChadClarkesMOSSBlog

Okay so I found some great info on this site about presence aware stuff: http://blogs.msdn.com/modonovan

# Become Presence Aware with your WebParts with just an email!

Wednesday, September 19, 2007 4:21 PM by SHAREPOINTBlogs.com Mirror

Okay so I found some great info on this site about presence aware stuff: http://blogs.msdn.com/modonovan

# Blogger Loser &raquo; Blog Archive &raquo; Become Presence Aware with your WebParts with just an email!

# re: How to add presence/pawn to SharePoint contacts list

Thursday, September 20, 2007 12:07 PM by klee

This is a great feature - I used it a few months back to query our AD via a web service and create an employee directory right through a DVWP.  I can provide presence information right from MOSS and a status indicator from our LCS server.  We also have our phone system integrated back to LCS so I can even inject URLs to place a call to the person's extention or cell phone which is also brought in from AD right from the directory.  One weird bug I've noticed is the roll-over menu on the LCS pawn seems to break as you scroll down the page.  The roll-over menu appears below the actual entry and moves further down the page the more you scroll.  Very strange - still haven't found a fix for it yet.

# Blogger Loser &raquo; Become Presence Aware with your WebParts with just an email!

# re: How to add presence/pawn to SharePoint contacts list

Friday, November 16, 2007 11:15 AM by stansmith78

Hi

I am currently planning to build an employee directory with presence information in our MOSS portal. Some of the approaches I have looked at are: creating a custom list containing user profile information imported into SSP from AD. The only thing is, I haven't been able to figure out how to create a custom list to hold user profile information. Another alternative is one of the comments left about this article about using a DVWP to display information for a web service that directly queries AD. If someone can suggest some alternatives; or, give me some advice on my present options, it would be greatly appreciated.

Thank you very much  

# Intégration de la présence dans SharePoint : merci IMNR

Tuesday, January 29, 2008 9:14 AM by The Mit's Blog

Je dérive un peu de mon Axe SharePoint pour m'ouvrir un peu plus sur le Monde IW et dans ce cas, OCS,

# SharePoint 2007 How To List &laquo; SharePoint Sherpa

Tuesday, February 12, 2008 8:27 PM by SharePoint 2007 How To List « SharePoint Sherpa

# re: How to add presence/pawn to SharePoint contacts list

Friday, February 22, 2008 2:02 PM by maldrak

Klee,

I have encountered this problem.  Three factors align to cause it: javascript, css, and the ActiveX control that renders the widget.  I won't try patching the ActiveX control.

The javascript problem occurs in init.js in the IMNGetOOUILocation or IMNShowOOUI function.  Certain css rules will alter where the ActiveX widget starts counting the oouiY offset from.  To compensate for the problem in javascript, oouiY should be reduced by document.body.parentNode.scrollTop.

To solve the problem with CSS, I can give the body element static positioning then give relative/absolute positioning to a descendant (form#aspnetForm worked for me).

Be careful if you muck with the css because MSOLayout_GetRealOffset has problems with some css configurations.  It is used when dragging web parts around the page to reorder them or place them in different zones.  The problem it has is that it ascends the DOM tree by offsetParent and terminates at the body tag.  When your css rules cause the offsetParent to never be the body tag, the loop jumps to the html tag then throws an error looking for the offsetParent.

# How to add presence/pawn to a non web app

Wednesday, December 31, 2008 5:14 AM by Amit

Does any one knows if one can embed the NameCtrl ActiveX in a non web application ?

Any code examples ?

I need to embed it in a C++ application.

Thanks,

Amit

# re: How to add presence/pawn to SharePoint contacts list

Friday, January 23, 2009 3:15 PM by Allyson Kreft

Can IMNRC be used with an Image Web control?

How do you set the ShowOfflinePawn attribute?

# re: How to add presence/pawn to SharePoint contacts list

Thursday, February 05, 2009 9:00 AM by Dale

SharePoint's default Contact Details web part also displays a job title field...

Rather than havin to manually input the job title field, is there a way to get IMNRC to auto fill the job title for us?

# Can I have a Live Meeting Link in presence menu from SharePoint

Thursday, March 05, 2009 1:23 AM by Akhila

I need to be able to schedule a live meeting from SharePoint. Can the presence menu be used to show a live meeting link , If yes how.

Thanks

Akhila

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker