Domanda

Ho una definizione di elenco con il campo di tipo utente .Ho bisogno di visualizzare la foto di un utente insieme con il suo nome.Per fare ciò sto usando showfield="namewithpicture" attriti come così:

<Field Name="Employee" ID="{33c2ee31-2927-4de3-8e7d-cc1f2676378b}" DisplayName="Name" Type="User" Required="TRUE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ShowField="NameWithPicture" />
.

Sfortunatamente in SharePoint 2013 sembra un problema con il markup risultante:

Inserisci Descrizione dell'immagine qui

Inserire l'immagine Descrizione qui

Qualcuno è riuscito a fare questo compito in SP 2013, per favore?Qualsiasi aiuto sarebbe davvero apprezzato!

È stato utile?

Soluzione 2

Finally, we've managed to find a good solution. So, basically, in SharePoint 2013, instead of

<Field Name="Employee" ID="{33c2ee31-2927-4de3-8e7d-cc1f2676378b}" DisplayName="Name" Type="User" Required="TRUE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ShowField="NameWithPicture" />

you need to use

<Field Name="Employee" ID="{33c2ee31-2927-4de3-8e7d-cc1f2676378b}" DisplayName="Name" Type="User" Required="TRUE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ShowField="NameWithPictureAndDetails" />

Notice ShowField attribute

No C# development needed, and no JavaScript crutches.

I hope it helps someone!

Update

I've noticed that this problem occurs when you don't include JSLink node inside schema.xml in a View:

<JSLink>clienttemplates.js</JSLink>

This happenes when you upgrade Visual Studio Solution with SharePoint projects from 2010 to 2013 version.

schema.xml file for your list template

Altri suggerimenti

This might be of some use.

Try to get the user profile using UserProfileManager. Then using GetProfileValueCollection(PropertyConstants.PictureUrl) you can get the image url of the user.

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