How to get name or id of person or group field to display in content query webpart


  • I have a person or Group field called ContactName but I can't get it to display "Name"(FirstName and LastName).

    The Group column and modified columns works perfectly but not the person or group field.

    I'm sure i'm missing something.  Is my OuterTemplate correct?

    <xsl:variable name="ContactName">
               <xsl:call-template name="OuterTemplate.GetTitle">
           <xsl:value-of select="@Contact_x0020_Name.title"></xsl:value-of>
         <xsl:variable name="modified">
         <xsl:value-of select="ddwrt:FormatDate(string(@Modified), 3081, 3)" />      
            <div class="item link-item">
            <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
            <a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
              <xsl:if test="$ItemsHaveStreams = 'True'">
                <xsl:attribute name="onclick">
                  <xsl:value-of select="@OnClickForWebRendering"/>
              <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
                <xsl:attribute name="onclick">
                  <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
              <xsl:value-of select="$DisplayTitle"/>
             <b>Last Modified @  <xsl:value-of select="$Group"/> Person @  <xsl:value-of select="$ContactName"/>
               Time @ <xsl:value-of select="$modified"/>

    mardi 5 juin 2018 04:28

Toutes les réponses

  • Can anyone from MS help me with this issue?
    mercredi 6 juin 2018 03:54
  • Hi,

    Please display the Person field name like this:

    <xsl:value-of select="@PersonColum.title" />      ----- for Name 
    <xsl:value-of select="" />         ----- for id

    Make sure the field internal name is valid.

    Here is a similiar thread for your reference:

    Get both ID and Name from a field of type 'Person or Group' in a Content Query web part


    Best Regards

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    jeudi 7 juin 2018 09:50
  • Thanks Jerry that's exactly what I did but its not working

    See below

    <xsl:variable name="ContactName">
               <xsl:call-template name="OuterTemplate.GetTitle">
           <xsl:value-of select="@Contact_x0020_Name.title"></xsl:value-of>

    Person @  <xsl:value-of select="$ContactName"/>

    But when I load the page the $ContactName is empty

    jeudi 7 juin 2018 13:08
  • Any ideas.
    How  can i  get the id and title (display name at the same time)?
    For the Person column i have created(Person and Group field)  and have set it to multiple selection and show column Name

     <xsl:variable name="Person">
         <xsl:value-of select="@Person.title" />      

    Can i also get

     <xsl:value-of select="" />   

    At this stage this doesn't return anything

    One more thing is when i get the display name the result looks like this James Blog ;#33;#Andrews Peace.

     how can i split and remove the ;and # to get James Blog,Andrew Peace

    • Modifié Patrick.I mardi 12 juin 2018 07:44
    mardi 12 juin 2018 07:44