I've been searching high and low for a couple of days for a solution, but can't find anything that fits. I've seen a lot of blogs refer to the Srch.U object and then using various methods. I've seen articles that point readers to the default item_person template. I've also seen the REST API mentioned, but am more confused than ever.
My current setup:
I'm using SharePoint Online. I have a very simple list called Team Members on a sub site with a few columns:
- Title (default column - contains a plain text version of the user's display -name typed in manually)
- TeamMember (People or Group currently set to Work Email so I can hook up the profile picture from Delve)
- Job Title (Text field).
I then very simply grab this information and do some stuff to make it all look pretty.
What I would like:
I'd like to be able to use the Person field to pull through a user's email, phone number and any other properties I might want in the future and display them in the template as required.
My current code:
<mso:ManagedPropertyMapping msdt:dt="string">'Title'{Title}:'Title','TeamMember'{TeamMember}:'TeamMember','JobTitle'{JobTitle}:'JobTitle,JobTitleOWSTEXT'</mso:ManagedPropertyMapping>
<div>
<!--#_
var Title = $getItemValue(ctx, "Title");
var TeamMember = $getItemValue(ctx, "TeamMember");
var JobTitle = $getItemValue(ctx, "JobTitle");
_#-->
<div class="row">
<div class="col-xs-4">
<a href="https://mydomain-my.sharepoint.com/_layouts/15/me.aspx?p=_#= TeamMember =#_"><img class="img-responsive thumbnail" src="https://mydomain.sharepoint.com/_layouts/15/userphoto.aspx?size=L&accountname=_#= TeamMember =#_" alt="_#= JobTitle =#_" /></a>
</div>
<div class="col-xs-8">
<h2 class="media-heading comrole"><a style="color: #CC0000;" href="https://mydomain-my.sharepoint.com/_layouts/15/me.aspx?p=_#= TeamMember =#_">_#= Title =#_</a></h2>
<h2 class="media-heading comUserName" data-membersip="_#= TeamMember =#_">_#= JobTitle =#_</h2>
<p><a href="mailto:_#= TeamMember =#_">_#= TeamMember =#_</a></p>
</div>
</div>
</div>
Any help as to what option to set my person field to and how to hook into the user's profile would be very much appreciated.
Thanks a lot,
Tom