Domanda

I have lists of a special item content type that I list using search. These list contain for instance a column of type Person or Group. In the lists the columns are being displayed as "Name (with picture and details)".

But with my display template I am just getting a long string displayed with the following info: "email address | Name | lots of digits i:0#.w|domain\account name"

I have read this article http://www.ableblue.com/blog/archive/2013/06/05/add-presence-to-sharepoint-search-results/ and it seems really nice to be able to display the name with a presence indicator, but I´ll be happy if I´d just get the name displayed in a nice way.

In the article it seems like he is working with another kind of object. All I have to work with is a managed property ManagerOWSUSER mapped to the column that I access using ctx.CurrentItem.ManagerOWSUSER

I guess I could do some string manipulation to find the name part. But I wonder if there is some proper object model to work with in this case? There seem to be many issues similar to this with search display templates.

È stato utile?

Soluzione

Try the below function.

Srch.U.getDisplayNameFromAuthorField(ctx.CurrentItem.EditorOWSUSER)

In your case,

Srch.U.getDisplayNameFromAuthorField(ctx.CurrentItem.ManagerOWSUSER)

I haven't tried it on a custom Person/Group column.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top