«

»

Mar
04

XSLT get email address from person field

In this brief post I will show you how to use xslt to get someone’s email address from the people picker in a SharePoint list. Before I begin I must give credit to David Botschinsky who I met at the BETT show in January. He came to me and asked about getting the email address of a person from the person lookup field in a list – He wanted to achieve this purely through the browser if possible with no code. I had a quick think and couldn’t find a way. I then received an email from David saying he did it through SharePoint designer in the end and it’s this I will share with you:

In SPD create a XSLT view of the list with the person field in. The usual <xsl:value-of select=’@person’ disable-output-escaping=”yes” /> code will return the familiar link that goes to the user information page. By changing the  ‘disable-output-escaping’ to ‘no’ you will return all the code behind this link- including the email address! Then with some xslt sub-string magic you can strip out all but the email address.

<xsl:value-of select= 'substring-before(substring-after(@person, concat("sip=",$dvt_apos)), $dvt_apos)' disable-output-escaping="no"/>

That is all there is to it!

About Chris McKinley

Chris McKinley has written 26 post on this blog.


Technorati Tags: , , ,

Related posts:

  1. Re download Read Email from Google mail In the past I have tried marking the mails as...
  2. The BETT Show 2010 Next week myself, Chris McKinley and Mike Herrity will be...
  3. The First Post   Myself and Chris McKinley have been posting the occasional...

1 comment

  1. forex robot says:

    Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>