Add multiple IDs to multiuser user textbox
-
08-01-2021 - |
質問
I've a sharepoint list with a user field called "Account".
In a sharepoint page I've added a textbox bound to this field and I managed to set the value by inserting the USERID
in the textbox.
Here is the texbox code:
<asp:TextBox runat="server" id="tbx_Account{$Pos}" Text="{@UserID}" Value="{@UserID}" __designer:bind="{ddwrt:DataBind('i',concat('tbx_Account',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Account')}"/>
In the same list I have another user field called ProjectTeam
. Unlike the Account field, this is a multi-user field. I've tried to set multiple IDs separating them with comas es. (3,47)
or with semicolon es. (3;47)
but the save action results in an error.
Which is the right way?
解決
The correct format for multi-user fields is ID;#LoginName;#ID;#LoginName
So something like:
10;#contoso\kfrog;#23;#contoso\mpiggy;
You can find additional details and examples here: https://blogs.msdn.microsoft.com/uksharepoint/2009/02/17/quick-tip-using-the-sharepoint-person-or-group-field-in-code/