views:

188

answers:

1

I have an InfoPath form embedded in an aspx page on a SharePoint site. How do I bind the SharePoint user groups to a drop-down list on my form? What I've tried so far is to create a data connection to a web service (method GetGroupCollectionFromWeb) to pull the data. Next, I open the list box properties, select "Look up values from an external data source", select the data source, assign the entries, and I get the following error:

"You must select a repeating group or field."

What I don't understand is that since the method I am calling is called GetGroupCollectionFromWeb, isn't the return value a collection? And aren't collections repeating by definition? What am I missing, and is there a workaround? Thank you.

A: 

Your specific problem I'm not too sure about because I never use data connections inside Infopath.

However the way I've done this before is with code behind on the form. Because the form is loaded from within a SharePoint ASPX page then the SPContext is available. I can use this to get to my lookup list, in your case the groups. I would use the object model to pull in this collection of groups. I would iterate over the collection adding each item to a new node within a repeating group in the main data source. I would set the drop down control to get it's values from this repeating group.

If I were to hazard a guess about the problem your facing, it would be that the XML returned by the web service isn't formatted nice enough for Infopath to use. In this case you could keep your data connection to retrieve the data but then you'll have to write some code to translate what the data connection comes back with into a format that the control can understand in the main data source.

Dan Revell