Below are some steps about extracting user group of current login user in infopath 2010 text field.I want to pen down my experiance with the above objective. Some of my friends encounter issues while come across though this requirement.


Checklists before commencement

  1. InfoPath 2010 form needs to be designed.
  2. This form should have two textbox namely “UserName” and “UserGroup”.
  3. Click on Manage “Data Connections” which is on the bottom preview of “Field” pane.
  4. Click on “Add” Button.
  5. Check on “Receive Data” which belongs to “Create new connection to”.
  6. Check the “Soap Web Service”.
  7. Put this URL “http://servername/_vti_bin/userGroup.asmx?WSDL” in text bar.
  8. Click on “Next” Button.
  9. Select “GetGroupCollectionFromUser” from the list.
  10. Click on “Next” Button.
  11. Click on “Set Sample Value” Button.
  12. Provide the value (essbbsr\sidhanta).
  13. Click on “Next” Button
  14. Click on Next Button
  15. Check on “Store a copy of the data in the form template”.
  16. Do not tick on “Automatically retrieve data when the form is opened”.
  17. In the “Data Connection” window click on “Add” Button.
  18. Check on “Receive Data” which belongs to “Create new connection to”.
  19. Check the “Soap Web Service”.
  20. Put this URL “http://servername/_vti_bin/ UserProfileService.asmx? WSDL” in text bar.
  21. Click on “Next” Button.
  22. Select “GetUserProfileByName” from the list.
  23. Click on “Next” Button.
  24. Click on “Next” Button by leaving “Set Value” of “account Name”.
  25. Check the “Store a copy of the data in the form template”.
  26. Check on “Automatically retrieve data when the form is opened”.
  27. Click on “Close” Button in “Data Connection” window pane.
  28. Go to “File” tab which is on top preview. 
  29. Click on “Publish”.
  30. Click on “SharePoint Server” button.
  31. Provide the web address.
  32. Make sure that your InfoPath form is published to the concerned Library.

Steps For Probable Solution

  1. Go to the File Tab.
  2. Click on “Publish”.
  3. Click on “Export Source Files” Button.
  4. Choose the Location.
  5. Close the InfoPath Form.
  6. Open the folder where the exported files reside.
  7. Right Click on “GetGroupCollectionFromUser1.xsd” which is a XML Schema file and it is around 24KB.
  8. Open it either by Notepad or WordPad.
  9.  Identify this line. <s:import namespace="http://www.w3.org/2001/XMLSchema"></s:import> Just below this line paste some lines. <s:complexType name="GetGroupCollectionFromUserType"><s:sequence><s:element minOccurs="0" maxOccurs="1" name="userLoginName" type="s:string"/><s:element minOccurs="0" maxOccurs="1" name="Groups"><s:complexType><s:sequence><s:element maxOccurs="unbounded" name="Group" ><s:complexType><s:attribute name="ID" type="s:unsignedShort"></s:attribute><s:attribute name="Name" type="s:string"></s:attribute><s:attribute name="Description" type="s:string"></s:attribute><s:attribute name="OwnerID" type="s:unsignedByte"></s:attribute><s:attribute name="OwnerIsUser" type="s:string"></s:attribute></s:complexType></s:element></s:sequence></s:complexType></s:element></s:sequence></s:complexType>
  10. Replace the following line  <s:element name="GetGroupCollectionFromUser"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="userLoginName" type="s:string"></s:element></s:sequence></s:complexType></s:element> With these 2 lines.<s:element name="GetGroupCollectionFromUser" type="tns:GetGroupCollectionFromUserType"></s:element>
  11. Save this file and make it Close.
  12. Again back the folder where the exported files reside.
  13. Right Click on “Manifest.xsf”.
  14. Choose “Design”.
  15. In “Data Connection” pane, go to “GetUserProfileByName”.
  16. Apply rule on “Property Data” field.
  17. The rule type is “Action”.
  18. The rule condition will be “Name=AccountName”.
  19. Click on “Add” button.
  20. Choose “Set Field Value”.
  21. For “Field” textbox go to “GetGroupCollectionFromUser”
  22. Go to “Query” field.
  23. Click on “userLoginName”.
  24. For the “Value” field Click on fx Button.
  25. Go to “Value” field in “GetUserProfileByName”.
  26. Click on “Filter Data..,” which is at bottom.
  27. Click on “Add” button.
  28. Click on “Name” field.
  29. In the “Condition” window put the equation “Name = AccountName”.
  30. Click on Ok and go back to Rule window.
  31. Again click on “Add” button.
  32. Click on “Query for Data” for “GetGroupCollectionFromUser”.
  33. Go to “UserGroup” textbox.
  34. Right Click on it. 
  35. Choose “Textbox Properties”.
  36. Click on “Insert Field or Group” button.
  37. Go to “GetGroupCollectionFromUser”.
  38. Click on “Data Field”.
  39. Click on “Group” after expanding 2 times.
  40. Click on “Name”.
  41. Click “Ok” and back to the form.
  42. Right click on “UserName” textbox.
  43. Choose “Textbox Properties”.
  44. Click on “Insert Function”.
  45. Put “userName”.
  46. Click “Ok” and proceed.
  47. Publish the form.


Problem Definition

Reference