Uwe82

when you create lists in sharepoint, it's possible to add afield for choosing a person or multiple persons.

I want exactly that for my list template. I have the following CAML syntax:
<Field Id="{8ADC8169-6BA9-4d7e-B77D-B0F8B79BBEC5}"
Name="Vertreter"
BaseType="Text"
DisplayName="Vertreter"
Type="User" Sealed="TRUE"
ShowInDisplayForm="TRUE"
ShowInEditForm="TRUE"
ShowInNewForm="TRUE"
ShowInListSettings="TRUE"
DisplayNameSrcField="Account"
List="UserInfo"
SourceID="http://schemas.microsoft.com/sharepoint/v3"/>

This works fine, you can select a user there. But I didn't find two options:
  • To be able, to select multiple people for this column
  • To restrict this field to people only, not user groups
How can I do that

Thanks


Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Uwe82

Who should get the idea, that you just have to put "Multi" behind the type text, to have multiple values in a field, so that it looks like this:

<Field Id="{8ADC8169-6BA9-4d7e-B77D-B0F8B79BBEC5}"
Name="Vertreter"
BaseType="Text"
DisplayName="Vertreter"
Type="UserMulti" Sealed="TRUE"
ShowInDisplayForm="TRUE"
ShowInEditForm="TRUE"
ShowInNewForm="TRUE"
ShowInListSettings="TRUE"
DisplayNameSrcField="Account"
List="UserInfo"
UserSelectionMode="PeopleOnly"
SourceID="http://schemas.microsoft.com/sharepoint/v3"/>

The other option "UserSelectionMode" is also not documented. Now it is in a forum's post ;)

By the way, I found the XML-structure of list definitions. So if you want to know, how a list definition done via SharePoint UI is done in CAML, take a look into the content-database of the web application, table dbo.AllLists, pick the list, where you want to get the definition and copy the content of the field tp_Fields into an XML-editor .... there it is.





Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Nguyen Van Nam

Hi,

I applied exactly your solution in my WSS 3.0 but I still can not select more than one person in Vertreter field with following msg: You are only allowed to enter one item.

Pls show me your exact code or any more step I have to take

Thanks very much.






Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Uwe82

Often, I had to delete the list and reinstall the feature again, when I made changes to existing fields. Did you try that




Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Nguyen Van Nam

Thank for your reply. I have reinstalled feature, restart iis and then recreate list but the result is still the same.

I also cretated a content type with a UserMulti field but still can not to input multi user to this field. Here is my work:

I created a content type named 'MyContentType':

1. MyContentType.xml:

< xml version="1.0" encoding="utf-8" >

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<!-- _filecategory="ContentType" _filetype="Schema" _filename="contenttype.xml" _uniqueid="e68b4af3-8f33-4248-a961-9bf1d5ed2498" -->

<ContentType ID="0x010100c13b332e590c4f54ba69c02326d531bb"

Name="MyContentType"

Group="Development"

Description="Developing Content Type"

Version="0">

<FieldRefs>

<FieldRef ID="{1950a668-18b0-4d7c-895d-6aa9888f49cc}" Name="MyContentTypeField" />

</FieldRefs>

</ContentType>

</Elements>

The field with ID of "{1950a668-18b0-4d7c-895d-6aa9888f49cc}" in MyContentntType.xml is declared in MyContentType.Fields.xml below:

2. MyContentType.Fields.xml

< xml version="1.0" encoding="utf-8" >

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<!-- _filecategory="ContentType" _filetype="File" _filename="fields.xml" _uniqueid="1950a668-18b0-4d7c-895d-6aa9888f49cc" -->

<Field

ID="{1950a668-18b0-4d7c-895d-6aa9888f49cc}"

Name="MyContentTypeField"

DisplayName="MyContentType Field"

StaticName="MyContentTypeField"

BaseType="Text"

Type="UserMulti" Sealed="TRUE"

ShowInDisplayForm="TRUE"

ShowInEditForm="TRUE"

ShowInNewForm="TRUE"

ShowInListSettings="TRUE"

UserSelectionMode="PeopleOnly"

SourceID="http://schemas.microsoft.com/sharepoint/v3"/>

</Elements>

In my Visual studio IDE tool appear a warning in UserSelectionMode="PeopleOnly" line:

Warning 1: The 'UserSelectionMode' attribute is invalid - The value 'PeopleOnly' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:int' - The string 'PeopleOnly' is not a valid Int32 value. D:\SharePointProjects\SharePointSolution\ContentTypes\MyContentType\MyContentType.Fields.xml

(if I ignore this warning and try to install this feature by stsadm -> appear 'The 'UserSelectionMode' attribute is invalid - The value 'PeopleOnly' is invalid according to its da
tatype 'http://www.w3.org/2001/XMLSchema:int' - The string 'PeopleOnly' is not a valid Int32 value.'
->fail to install the feature)

When use a Reflector tool to deassemble Microsoft.SharePoint.dll, I found that: PeopleOnly = 0 and PeopleAndGroup = 1.

public enum SPFieldUserSelectionMode
{
  PeopleOnly,
  PeopleAndGroups
}

-> Then I replate UserSelectionMode="PeopleOnly" with UserSelectionMode="0" -> there is no warning anymore and the feature is successful installed. Be low is my feature.xml:

< xml version="1.0" encoding="utf-8" >

<Feature Id="{5337AE21-9650-4dbb-BEBE-C0303F4FD2A6}"

Title="My Content Type"

Description="My test content type with UserMulti field"

Version="12.0.0.0"

Hidden="FALSE"

Scope="Site"

DefaultResourceFile="core"

xmlns="http://schemas.microsoft.com/sharepoint/" >

<ElementManifests>

<ElementManifest Location="MyContentType.Fields.xml"/>

<ElementManifest Location="MyContentType.xml"/>

</ElementManifests>

</Feature>

Now my content type is successfully to install:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o
installfeature -filename MyContentType\feature.xml

Operation completed successfully.


C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o
activatefeature -filename MyContentType\feature.xml -url
http://namnvpc:18080

Operation completed successfully.


C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>iisreset

Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted

But when I created a Document list of this new content type -> MyContentType field is still accept only one single user

Could you create 3 xml files by copy from here and deploy in to your WSS to test for me

Thanks so much.






Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Jonesin

Hi,

Just wondering, has anyone resolved this issue I've the same problem where I'm installing a custom list with a "UserMulti" field, but I'm ending up with the "You are only allowed to enter one item." message.

Thanks!





Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

fetcher2007

hi

im having the same problem. has anyone found a solution

thanks





Re: SharePoint - Design and Customization User field with multiple users to check via schema.xml

Bisbjerg

I had the same problem.
It turned out to be the schema.

Have you checked the entry for your user field

It should look something like this:

<Field ID="{guid}"

Name="Users"

SourceID="http://schemas.microsoft.com/sharepoint/v3"

StaticName="Users"

Group="MyGroup"

Type="UserMulti"

UserSelectionMode="0"

UserSelectionScope="0"

Mult="TRUE"

List="UserInfo"

DisplayName="Users"

Sortable="TRUE"

Description="Users"

Sealed="TRUE"

ColName="int1"

RowOrdinal="0" />

UserSelectionMode: 0 is for PeopleOnly, 1 is for PeopleAndGroups

UserSelectionScope: 0 is for all users. If you need to limit it to a certain SharePoint group, you must pick up the id for this group, which is an integer. I used the listgenerator from the SharePoint Solution Generator for this.

/Bisbjerg