Skip to main content

Using the SharePoint User Type Field (People or Group) in List definition

In one of my project I have requirement to display user email address in People or Group Column instead of displaying default Name with presence. To change the field property is very easy by going into a list setting and click on the column under the columns group. There you can see the section named “Additional Column Settings” and changing the Show Field value to Work e-mail.
But what if you are creating list from List Definition template available in the visual studio and want to define People or Group column (User Field) by displaying user Work e-mail by default.
In this post I’m going to show you how to create field definition for People and Group column (i.e. User Field) in SharePoint list and what are the possible values available to show when displaying People and Group Column.
The following example shows you the schema for creating List Definition that creates SharePoint list with People or Group site column.
When I deploy the list and enter a value in my User Email field, it displays the user account name in the User Email field.
This default behaviour of list is because I define ShowField=“Name”What if we want to display different values for the same user in People or Group column for e.g. Email, Presence Indicator, Name With Picture and so on. 
To do this we have following available options that we can define in ShowFieldattribute to display different values in People or Group column. 
Following table show you the list of available values for User field (i.e. People or Group column).
For an instance if I define ShowField=”NameWithPictureAndDetails” in list definition schema. It will display the Name (with picture and details) in the User Email field.

Comments