I have following code (didn't list the whole code) behind a button on a InfoPath Managed Form. and it works meaning I can submit data to a list. Now I have 2 controls on the form that is Multiple-Selection List Box (Data source is a sharepoint list). The Target column (Lookup type with Allow Multiple values) in the target list is "Counties". Both Infopath and target sharepoint list gets information from a list called "City". How would I code
item["Counties"] = need help here; SPListItem item = list.Items.Add(); item["Title"] = MainDataSource.CreateNavigator().SelectSingleNode("//my:fldTitle", NamespaceManager).Value;
Updated: Found this piece. I guess I will still need to find out the XML way to extract id and it's value from xml tree of Multiple selection List.
SPListItem item = SPContext.Current.List.GetItemById(1); SPFieldLookupValueCollection values = new SPFieldLookupValueCollection(); values.Add(new SPFieldLookupValue(1,string.Empty)); values.Add(new SPFieldLookupValue(3,string.Empty)); item["LookupField"] = values; item.Update();
I found another cool link. I think I am good now. http://www.bizsupportonline.net/blog/2009/03/programmatically-retrieve-selected-items-multiple-selection-list-box-infopath/