We were recently trying to figure out why Active Directory’s GetMyInfo method is not working on one of our user’s form. The form is IPFS-enabled using a UDC connection to query the Active Directory web service. The problem was that the user could not filter the Value returned by the Active Directory method. It turns out that he was trying to query the Active Directory information to populate a dropdown and was not able to filter since InfoPath does not support dropdown filtering when using browser-enabled forms. For example, see this blog post. To demonstrate, let’s suppose you are using the Expense Report template that ships with InfoPath 2007 and you need to query your name in the Name field. For whatever reason, you opted to use a dropdown to display the data. So your form now looks like this:
Then, you open your dropdown list box’s properties and proceeded to set the parameter to query the secondary data connection GetMyInfo method. However, when you reach Step #3 (see image below), to filter data from the repeating ADProp table, an error is displayed, stating that filtering on browser-enabled form templates is not allowed:
This is not the case when filtering on a dropdown and the form is not browser-enabled:
If it’s not necessary to browser-enable the form, you can change the settings by unchecking Browser compatibility option in Tools > Form Options > Compatibility:
However, if your form needs to be browser-enabled, the workaround is to avoid using dropdown fields when querying ADWS. Assuming that you are now using a text field to query, below is a step-by step procedure on how to accomplish this:
1. Create a new data connection to the Active Directory Web Service:
a. Click on Tools > Data Connections > Add. This will open the Data Connection Wizard.
b. Select Receive Data and click Next.
c. Select To a Web service and click Next.
d. Type in the URL for the Active Directory Web Service (for example http://servername/qdabrawebservice/ADUserInfo.asmx) and click Next.
e. Select the GetMyInfo method and click Next.
f. Do not check Store a copy of the data in the form template and click Next.
g. Check Automatically retrieve data when form is loaded and click Finish. h. Finally, close the Data Connections window.
2. Create the field and the rule to set its value.
a. Navigate to Controls in the task pane and click on Text Box.
b. Double-click on the textbox field in the view.
c. In the Default Value section, click on the fx button to the right.
d. Click Insert Field or Group.
e. Select the GetMyInfo (Secondary) data source from the dropdown.
f. Expand the xml tree to reach the node dataFields/tns:GetMyInfoResponse/GetMyInfoResult/ADProp
g. Select Value and click Filter Data.
h. In the Specify Filter Conditions dialog, click Add.
i. Select Key in the first drop down.
j. Leave the second dropdown set to is equal to.
k. In the third dropdown type the text "displayName" without the double quotes. Notice that InfoPath adds double quotes after you type and tab out.
l. Click OK to close every dialog.
m. Save your form.
n. Preview the form. The value for the key you selected is now automatically loaded to the textbox.
Add more functionality to your form by querying your email address as well as your Manager’s name and email address (See image below). You can watch this cool video demo on how to filter ADWS and achieve this:
To help you get your form up on SharePoint, the following steps will demonstrate how the SharePoint feature in DBXL can accomplish this for you. This assumes that you have installed DBXL v2.3 on your machine and have already configured your form as a Document Type that submits to DBXL. In this example, we already configured Expense Report template to submit to DBXL and published it as a Document Type.
3. Configure your SharePoint mapping
a. In DBXL, click on Edit Configuration for your template.
b. Go to the SharePoint tab.
c. Click on Insert Mapping.
d. Enter the URL of the SharePoint library you wish to create. The SharePoint server should be in the same machine where DBXL is installed.
e. Select Object Model.
f. Check the checkboxes for Publish form and XSN and Use Forms Services.
g. Click Save, and then OK in the confirmation dialog.
4. Enable the SharePoint library for IPFS
a. In Internet Explorer, open the SharePoint library you created, click on Settings and select Form Library Settings.
b. Click on Advanced settings in the General Settings section.
c. Select Display as a webpage radio button in the Browser-enabled Documents section. Click OK.
5. Test the solution
Remember to keep in mind that this will not work if you’ll be using dropdowns to display the value from the Active Directory list.
a. In Internet Explorer, open the SharePoint library created in step 7.
b. Click on New. Fill out the form and click Submit.
c. Go to the Documents tab in DAT and click New. Fill out the form in InfoPath and click Submit.
d. You can also test:
i. From DAT, open and submit the form that was created from the browser.
ii. From Internet Explorer, open and submit the form that was created from DAT.