views:

83

answers:

1

I need to display a list of document libraries a user has permission to on an infopath form for a workflow. I can build my list of libraries just fine but I can not for the life of me figure out how to populate (in anyway) the infopath form with the list of libraries and allow the user to somehow say "yes" or "no" to each (checkbox is ideal but I'll take anything at this point).

Basically I just need to figure out how to add a list of items for yes/no to a user in the loading event so I can take that information and do something with it.

+1  A: 

I tend to use a repeating table with two columns, one containing a checkbox and one a label. Group these together properly in a schema then you can pop some code behind in to iterate through your list of libraries and pop nodes onto the end of this repeating table pre populated.

Here is an example that sets a label inside a repeating table on an InfoPath form:

XPathNavigator xmlDoc = MainDataSource.CreateNavigator();
XPathNavigator xmlItem = xmlDoc.SelectSingleNode("/my:MyForm/my:MyRepeatingGrp", this.NamespaceManager);

foreach (XmlNode libraryNode in documentLibraries)
{
XPathNavigator newItem = xmlItem.Clone();
XPathNavigator navText = newItem.SelectSingleNode("/my:MyLabel", this.NamespaceManager);
navText.SetValue(libraryNode.Attributes["LibraryName"].Value);
xmlItem.InsertAfter(newItem);
}

xmlItem.DeleteSelf();
Dan Revell

related questions