Nov 21, 2012

Visual Studio 2012 Bug in Visual List Designer (ArgumentException: Requested value 'People Only' was not found.)

Today I'm creating some list definitions in Visual Studio 2012.
I work with UserFields and I set it's properties:




As you can see on screenshot there are only three properties for Field Type "Person or Group":
  • SuppressNameDisplay
  • UserSelectionMode
  • UserSelectionScope
I found the bug when using UserSelectionMode property.
It has two values:
  • People Only
  • People and Groups


The problem is that these values are incorrect. When you try to use this SharePoint list or if you try to navigate to UserField's property page you will get the error:


ArgumentException: Requested value 'People Only' was not found.

Cause:
According MSDN, correct values are without spaces:
  • PeopleOnly
  • PeopleAndGroups
Solution:
To solve the problem, open schema.xml file of the list definition in XML Editor and fix SelectionMode value like this:
<Field Name="SomeUserField" ID="{5b1c3a12-3c4a-4fe3-81c4-5aeab2207914}" DisplayName="SomeUserField" Type="UserMulti" Mult="TRUE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="TRUE" ShowInNewForm="FALSE" ShowInViewForms="FALSE" SuppressNameDisplay="FALSE" UserSelectionScope="0" UserSelectionMode="PeopleOnly" />
That's it!


Additional Environment Info:
Visual Studio 2012 exact version is 11.0.50727.1 RTMREL
SharePoint 2010 Enterprise.

Update1:
The bug is posted to Microsoft Connect with no response from MS yet.

5 comments: