2010-07-26 57 views
0

我在Sharepoint中列有新列「第一批批准人」。 此列的類型是「Person或Group」,「Allow multiple selections」設置爲「Yes」。Sharepoint:如何獲得專欄的價值?

如何在運行時(從工作流程)獲取和修改此列的值?

回答

1

假設您已經綁定WorkflowProperties到類..

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

然後你就可以在訪問集合/修改的收集和保存更改回來:

WorkflowProperties.ListItem["First line approvers"] = f.ToString(); //You might not need the to string here, I can't remember. 
+0

我試試這個方法但沒有工作:| 來自工作流程: SPFieldUserValueCollection f = new SPFieldUserValueCollection(workflowProperties.Web,workflowProperties.List.Fields [「First line approvers」] +「」); 從頁: SPFieldUserValueCollection f = new SPFieldUserValueCollection(Web,item.Fields [「First line approvers」] +「」); – Dumitru 2010-07-27 09:16:22

+0

「.ListItems」要求Guid的字段或索引... 如果我試圖通過索引獲取值,我也獲得空的SPFieldUserValueCollection。 – Dumitru 2010-07-27 09:29:00