Add a user pickup field in a custom content type

It's seems to be difficult to create a pickup field for users or groups but it's really easy.

This is a way to to this using the xml schema of our content type.

< Field ID="{47A9E79B-705B-4586-B697-01B2609CEC1F}" Name="AffectedPersons" BaseType="Text" DisplayName="Personnes affectees" Type="UserMulti" Sealed="TRUE" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" ShowInListSettings="TRUE" List="UserInfo" UserSelectionMode="0" UserSelectionScope="0" Mult="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" / >

This sample allow us to select multiple users. To select only one user you can use Type="User" instead of Type="UserMulti" and you should remove the Mult property.

If you got the error : The 'UserSelectionMode' attribute is not allowed. you should install the hotfix for sharepoint. http://support.microsoft.com/kb/934613

Enregistrer un commentaire