Document set content type issue in SharePoint 2013

Problem statement:   When we create new Document set in Documents library which is having default values for a people and group column, getting following X X X X X X kind of characters in people and group type column value. (Find below screenshot).


Steps to reproduce:

  1.        Go to Document library, in my case Documents
  2.        Go to Library settings
  3.        Go to Advanced settings and set Yes to Allow management of content types?
  4.        Add Document set content type to library. As shown in below screen shot.
  5.        Go to Create column in library and create new column of type Person or Group with some name. In my case I have given name as TestPeople

6.       Now set default value to the newly added list column using PowerShell script

$w = Get-SPWeb "http://myspmachine/";

$l = $w.Lists["Documents"];

$fld = $l.Fields["TestPeople"];

$usr = $w.EnsureUser("myspmachine\prasad.pathak");

$spFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($w);

$spFieldUserValue.LookupId = $usr.ID;

 

$fld.DefaultValue = $spFieldUserValue.ToString();

$fld.Update();

 

$l.Update();

 

8.   Confirm or add this site column is part of Document and Document Set content type both. As shown below.

   9.   Now got to Documents library, File tab and select New Document and Document Set

10.       Now you can see the error appearing like following.


      11.   Same way if you upload some document with Document content type and check for the same column you will not find any issue with document content type.

 12. So this issue with Document set content type only.


May 21st, 2015 1:48am

$w = Get-SPWeb "http://myspmachine/";

$l = $w.Lists["Documents"];

$fld = $l.Fields["TestPeople"];

$usr = $w.EnsureUser("myspmachine\prasad.pathak");

$spFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($w);

$spFieldUserValue.LookupId = $usr.ID;

 

$fld.DefaultValue = $spFieldUserValue.ToString();

$fld.Update();

 

$l.Update();  


Hi Prasad,

As I tested, the issue is caused by this powershell script.

I create a person or group column in a custom list, then use the script to set default value of this field. The issue occurs when I create a new item in this list.

You could test the issue via creating a new custom list.

If you need to set default value of a person or group column, there is no OOB UI way. Here is a similar thread for your reference:

https://social.msdn.microsoft.com/Forums/en-US/f2de4f24-21dc-452b-96c4-1da9633bfb38/default-value-for-person-or-group-column-in-a-sharepoint-2010-custom-list?forum=sharepointcustomizationprevious

Regards,

Free Windows Admin Tool Kit Click here and download it now
May 21st, 2015 11:27pm

Hi Rebecca,

For quick help, Actually I wanted to set the default value using C# code and when I tested with equivalent PowerShell I was able to reproduce the issue. looking like a product bug?

Is there any other supported way in SharePoint 2013 using which we can set the People and Group column default value and not get the reported error?

Regards,

Prasad Pathak

May 22nd, 2015 12:26am

Hi,

I found some articles about setting default value for person or group column for your reference:

CSOM
http://blogs.msdn.com/b/kaevans/archive/2013/11/30/setting-a-sharepoint-person-or-group-field-value-with-csom.aspx

Javascript/jQuery code
https://developershelper.wordpress.com/2014/09/07/sharepoint-set-default-value-for-person-or-group-or-people-picker-editor/
http://janaka-jeewantha.blogspot.jp/2011/02/how-to-set-sharepoint-people-picker.html

SPService
http://vaqarhyder.blogspot.jp/2013/06/sharepoint-20102007-setting-value-of.html

Other workaround:
https://social.msdn.microsoft.com/Forums/en-US/f2de4f24-21dc-452b-96c4-1da9633bfb38/default-value-for-person-or-group-column-in-a-sharepoint-2010-custom-list?forum=sharepointcustomizationprevious

Regards,

Free Windows Admin Tool Kit Click here and download it now
May 25th, 2015 10:40pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics