Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list similar to the usual Tasks Sharepoint List and I introduced the field assigned to as a multi user field like this (I have read somewhere that with Mult option should always be set to TRUE) :

<Field ID="{E942F982-C798-4095-8FD3-AF9A3A374862}" Type="UserMulti" Mult="TRUE" Name="AssignedTo" DisplayName="Assigned To" Group="My Local Group"  StaticName="AssignedTo" ShowInEditForm="TRUE" ShowInNewForm="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" />

to set this field I created a control to get the users:

UserField AssignedTo = new UserField();
AssignedTo.FieldName = ActionsCommercialesManagement.Fields.AssignedTo;
AssignedTo.ID = "AssignedToID";
AssignedTo.ListId = TaskListID;
PlaceHolder.Controls.Add(ACAssignedTo);

and to recuperate the introduced userS in my AssignedTo userField control I tried to do something like this but it didn't work :

newItem = MyList.AddItem();
newItem["AssignedTo"] = new SPFieldUserValueCollection(ACAssignedToID.Value.toString());
NewItemButton.update();

So any ideas ????

share|improve this question

1 Answer 1

if anyone is having this problem I just solved it :

SPFieldUserValueCollection assignedUsers = new SPFieldUserValueCollection(myWeb, AssignedTo.Value.ToString());
item["AssignedTo"] = assignedUsers;

and if you want to retrive the value collection as string all you have to do is :

string spliAssignedTo =((SPFieldUserValueCollection)TaskItem["AssignedTo"]).ToString();

Hope I helped :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.