Home > Microsoft SharePoint, Microsoft SharePoint 2010, SharePoint2013 > Setting ‘Show field’ for “Person or Group” type column using PowerShell

Setting ‘Show field’ for “Person or Group” type column using PowerShell

Hi Friends,

While fixing one issue I needed to change the ‘Show field’ setting for “Person or Group” type of column like Modified By column, My first thought is to use ‘ShowField’ property of a column as I seen this property exist in <Field XML.

Bellow image shows the “show field” option on Edit column page.

Show_Field

I tried multiple option with ‘ShowField’ but no luck and the property was not changing, then after debugging the issue I found that we need to use column’s “LookupField” property to change the setting like following.


Add-PSSnapin Microsoft.SharePoint.PowerShell
$webURL = "<Your web url>";
$web = Get-SPWeb $webURL;
$mylistName = "<Your list name>";
$mylist = $web.Lists[$mylistName];
$mycolumn = $mylist.Fields["Modified By"];
$mycolumn.LookupField = "Title";
$mycolumn.Update();
$mylist.Update();

The other available options to set the ShowField are as following table-

Sr.No. Show Field drop down options Exact value need to pass LookupField property
1 Name Title
2 Account Name
3 Work email EMail
4 Mobile phone MobilePhone
5 SIP Address SipAddress
6 Department Department
7 Title JobTitle
8 First name FirstName
9 Last name LastName
10 Work phone WorkPhone
11 User name UserName
12 Office Office
13 ID ID
14 Modified Modified
15 Created Created
16 Name (with presence) ImnName
17 Picture Only (36×36) PictureOnly_Size_36px
18 Picture Only (48×48) PictureOnly_Size_48px
19 Picture Only (72×72) PictureOnly_Size_72px
20 Name (with picture and details) NameWithPictureAndDetails
21 Content Type ContentTypeDisp

Hope this will help someone from developer community.

Advertisements
  1. nlvraghavendra
    April 10, 2014 at 10:18 am

    Thanks. It helped.

  2. February 4, 2015 at 9:17 am

    How to add other properties then this 21 properties(like Manager or Job-title),which are already exist in User profile in People and group field type.

    • February 12, 2015 at 6:11 am

      Hi Rujal,

      Your requirement is not that much clear to me but I don’t think we can not directly use other properties, you need to pull that programmatically or through rest API.

      Best Regards,
      Prasad Pathak

  3. Benjamin Garcia
    August 19, 2015 at 3:27 pm

    Thanks for this help … it work
    – It show Name in list display (ShowField = Name)
    – With Powersell i get “Account” not Name

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: