views:

40

answers:

1

Hi all,

I have list in Sharepoint with new column "First line approvers". Type of this column is "Person or Group" and "Allow multiple selections" is set to "Yes".

How can I get and modify values of this column in runtime(from workflow) ?

+1  A: 

Assuming you've bound WorkflowProperties to the class..

SPFieldUserValueCollection f= new SPFieldUserValueCollection(WorkflowProperties.Web,WorkflowProperties.ListItem["First line approvers"] + "");

Then you can iterate over the collection / modify the collection and save your changes back by:

WorkflowProperties.ListItem["First line approvers"] = f.ToString(); //You might not need the to string here, I can't remember. 
Daniel
I try this methods but not working :|from workflow: SPFieldUserValueCollection f= new SPFieldUserValueCollection(workflowProperties.Web, workflowProperties.List.Fields["First line approvers"] + "");from page: SPFieldUserValueCollection f= new SPFieldUserValueCollection(Web, item.Fields["First line approvers"] + "");
Dumitru
".ListItems" require Guid of the field or Index...If I try to get value by index also I obtain empty SPFieldUserValueCollection.
Dumitru