Archive for October, 2013

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

October 10, 2013 4 comments

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.


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";

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.