Using Sharepoint UserGroup Web Service with InfoPath Forms Service

When you create a data connection to the UserGroup Sharepoint Web Service and select the GetUserCollectionFromGroup method, Infopath doesn’t interpret the results correctly and you can’t use the data connection in a Drop Down List control. I’ve seen examples which use code to get around this problem, but I’m using the Forms Service so code is not an option. We need to modify Infopath’s xsd file of the web service data connection to fix the problem.

In the example below I will create a data connection to the http://moss/_vti_bin/usergroup.asmx web service to receive data to use in a Drop Down List to pick from the members of a Sharepoint Group.

1. Create the Data Connection

2. Select Web Service

3. Enter the URL to the UserGroup web service, don’t forget to include your site in the URL if appropriate.

4. For this example I’m using the GetUserCollectionFromGroup method

5. Provide InfoPath with an example Group Name
6. Provide InfoPath with the actual Group Name you want this Data Connection to query
7. Choose if you want to store a copy of the data in the form template for use in Offline mode. Since I’m using the Forms Service the form will never be used offline, so I’m leaving the box unchecked
8. Give your new Data Connection a name and Finish the wizard

Next we need to save the Form so we can manually edit the XSD for the Data Connection. From the File drop down manu choose Save as Source Files…
Open the folder where you saved the Form and you should see a Developers1.xsd file, edit this file with your favourite XML Editor (or notepad). Update the file so it looks like the snippet below, I’ve put in a comment at the start and end of the modification.

<schema elementformdefault="qualified" targetnamespace="" xmlns:http="" xmlns:mime="" xmlns:s="" xmlns:soap12="" xmlns:soap="" xmlns:soapenc="" xmlns:tm="" xmlns:tns="" xmlns:wsdl="">
 <complextype name="GetUserCollectionFromGroupType">
   <element maxoccurs="1" minoccurs="0" name="Users">
      <element maxoccurs="unbounded" name="User">
        <attribute name="Notes" type="s:string"></attribute>
        <attribute name="Name" type="s:string"></attribute>
        <attribute name="IsSiteAdmin" type="s:string"></attribute>
        <attribute name="Sid" type="s:string"></attribute>
        <attribute name="ID" type="s:string"></attribute>
        <attribute name="LoginName" type="s:string"></attribute>
        <attribute name="Email" type="s:string"></attribute>
        <attribute name="IsDomainGroup" type="s:string"></attribute>
 <element name="GetUserCollectionFromSite">
We need to change another part of this file, replacing a s:element block.
<!--<s:element name="GetUserCollectionFromGroup">
      <s:element minOccurs="0" maxOccurs="1" name="groupName" type="s:string"></s:element>
<!-- Beginning of insert -->
<s:element name="GetUserCollectionFromGroup" type="tns:GetUserCollectionFromGroupType" />
<!-- End of insert -->
Now save the Developers1.xsd file, right click on the Manifest.xsf file and choose Design.

Add a Drop Down List Control and set its Data Source to Developers, you should now be able to select the correct attributes returned from the web service.

You can Save the Form as a standard XSN file, but DO NOT edit the Developers Data Source in InfoPath or you will overwrite the changes made to the Developers1.xsd file.


stephaniedehart said...

I'm using InfoPath Designer 2010 and trying to follow your example here, but the .xsd file that infpath generates looks nothing like the one in your example. I'm guessing you used InfoPath 2007, because in 2010 you can't do Save As Source Files. You have to go under Publish, and then Export Source Files.

Anyway, in your post you say, "Open the folder where you saved the Form and you should see a Developers1.xsd file, edit this file with your favourite XML Editor (or notepad). Update the file so it looks like the snippet below, I’ve put in a comment at the start and end of the modification." But there aren't any comments to mark the start and end, and since my file is nothing like yours I can't tell what you changed. I can post my whole file if it helps, but it's pretty big.

Would you mind marking what you changed in your first snippet like you did in the second one?

Ian said...

This was done using InfoPath 2007. I think it was the list of attributes that I added in the first snippet, but I can't be sure. Would you be able to try this using InfoPath 2007 and then you should be able to see what changed ? I don't have access to a copy of InfoPath 2010, if I did then I would write an updated blog entry that shows the process for 2010.

Hamid said...

Hi Ian,

I have done everything you have said up to the point I have to open the manifest file in design mode. However, I get this error and infopath doesnt allow me to open the manifest:

Infopath cannot open the following form: C:\manifest.xsf
The XML schema specified in the form definition (.xsf) file for dataObejct "Developer" cannot be used.

I have tried to change the file several time to make it like yours however I keep getting this error.
do you have any idea where i am wrong?


anaolala said...

Yes, I have the same problem as Hamid does, everything is ok till I try open manifest. xsf


Anonymous said...

Hi Ian,

Would it be possible for you to display the entire developers1.xsd file with this article? I'm trying to make the changes illustrated and it's not working. I'm pretty new to XML, though, so I'm sure it's something I'm doing wrong. Any help would be appreciated!

Anonymous said...

I followed each but I also get the "...cannot be used"

Hope you can enlighten us..

Brendan said...

For SharePoint 2010, you have to paste your snippet for the element underneatht he IMPORT statement at the top of nameOfService1.xsd (where nameOfService is the name for your data connection) and then follow instructions as normal within that file and all is well. Just be sure to UNcheck the 'automatically query this data source' option and then SET the userLoginName under the 'queryFields' in your data connection in InfoPath.

George said...


that solution didnt work for me. I still get "The xml schema file specified in the form definition (.xsf) file for data Object "GetUsercollectionFromGroup" cannot be used" error.

Anybody found a solution for that issue or a workaround?
I know for most people this article worked without a hitch, so I'm interested in finding out why it doesnt work for me.

Edwin Roestenburg said...

For me it helped to change capitalizatin (minOccurs, maxOccurs, complexType)

Lars said...

I agree with Edwin about capitalizing the complexType tags and minOccurs attribute names, as well as adding the "s:" prefix to all tags. And run an XML validator to make sure your file is valid.

bllittle said...
This comment has been removed by the author.
bllittle said...
This comment has been removed by the author.
bllittle said...
This comment has been removed by the author.
Anonymous said...

Watch for

already in the file.

Also, the schema tags (top/bottom) aren't needed and case is important.

NeveraNullMoment said...

Hey All,

I got this working in InfoPath 2010 customizing a SharePoint list form. Basically, follow the instructions here:

There are two files you need to modify: (1) dataconnectionname.xsd and (2) dataconnectionname1.xsd.

Follow the instructions in my link I referenced for the dataconnectioname1.xsd file. You just need to replace the one element.

Hope this helps someone!

Alison said...
This comment has been removed by the author.
Alison said...

I resolved the manifest error by adding a closing element tag to the s:element name="GetUserCollectionFromGroup" type="tns:GetUserCollectionFromGroupType"

MOF said...

thank you for great artical, but i am getting an error in step number 6,when i add sample vale for sharepoint group name, the error Group cannot be found.please help

Anonymous said...

Hey Peeps. I found that adding TWO hyphens in the "Comment" tag solved this. ie:

Look at Sue Hernandez's post that uses Ian's as a source (if you can get in)

Peter said...
This comment has been removed by the author.
Peter said...
This comment has been removed by the author.
Peter said...

If you add an extra elment above the "Users" element that looks like this " s:element minOccurs="0" maxOccurs="1" name="groupName" type="s:string" " you will retain the groupName in the queryfields and be able to query for a group.

Rettajm said...

How do I do this for multiple buttons used for different views within the same form.

Rettajm said...

How do I do this form multiple buttons on the same form?

timothy dempsey said...
This comment has been removed by the author.
Anonymous said...

To stop the error: "The xml schema file specified in the form definition (.xsf) file for data Object "GetUsercollectionFromGroup" cannot be used" error", ensure that the group you are referencing is set so that Everyone can see the members.

Dinh Ha said...

đồng tâm
game mu
cho thuê nhà trọ
cho thuê phòng trọ
nhac san cuc manh
số điện thoại tư vấn pháp luật miễn phí
văn phòng luật
tổng đài tư vấn pháp luật
dịch vụ thành lập công ty trọn gói
nước cờ trên bàn thương lượng
nghịch lý
chi square test
nghệ thuật nói chuyện
thuyết kỳ vọng
chiến thắng con quỷ trong bạn
cân bằng nash

Ánh đèn đường sáng rực chiếu vào trong xe. Triệu Quốc Đống nhìn ra ngoài, đến khi Cù Vận Bạch hơi bị nghiêng người va vào thành xe kêu lên thì mới khiến hắn nhìn lại.

Chẳng qua hắn thấy một cảnh đẹp cả đời khó quên.

Hai chân Cù Vận Bạch bởi vì co lên khiến chiếc váy bị rách càng lộ rõ. Chiếc quần lót đen hình ren cứ thế lộ ra trước mắt hắn. Đám lông đen như ẩn như hiện từ trong những khe hở, thật quyến rũ.

Đồng thời ngay bên cạnh cũng có một cảnh đẹp không thể bỏ qua. Đôi chân thon dài của Đồng Úc bởi vì ở đây khá chật nên không thể không co lên. Chiếc sườn xám cô mặc để biểu diễn được kéo lên, cặp đùi trắng nõn lộ ra làm người ta động lòng. Đồng Úc cũng không ý thức được bởi vì mình ngồi như vậy khiến nửa bờ mông đầy đặn lộ ra, chiếc quần lót màu trắng sữa đúng là quá nhỏ, chỗ giữa hai chân giao nhau làm Triệu Quốc Đống muốn điên lên.

Triệu Quốc Đống cố gắng khiến mình nhìn sang chỗ khác. Hắn nuốt ực một tiếng. Nhưng chỉ vài giây là hắn phát hiện mình không thể khuất phục sinh lý và tâm lý, ánh mắt lại quay về mấy chỗ đẹp mắt kia. Một đen một trắng in sâu vào trong lòng Triệu Quốc Đống.

Quãng đường không đầy 3km làm Triệu Quốc Đống hận không thể kéo dài thật lâu. Lúc này Triệu Quốc Đống chỉ thấy đêm nay đến Đồn công an đúng là không tệ.

Vừa đến Đồn công an, ba người được đưa vào một căn phòng. Triệu Quốc Đống thấy chuyện này không ổn. Cù Vận Bạch tất nhiên không muốn làm phiền Huyện ủy, Ủy ban.

Chẳng qua phân cục Hoa Khê được xưng là phân cục lớn nhất tỉnh. Mấy trụ sở Tỉnh ủy, Ủy ban nhân dân tỉnh, Hội nghị Hiệp thương Chính trị Nhân dân tỉnh, Đại hội đại biểu nhân dân toàn quốc đều ở đây. Hơn nữa còn là khu vực tài chính và buôn bán sầm uất. Tên lùn kia có thể làm Trưởng đồn ở đây thì nhất định không đơn giản. Hơn nữa tên thanh niên kia cũng rất có lai lịch.