Introduction
In many cases, when filling in a form, some of the data must be user names. Users coming from SharePoint as you work together in a Team.
A possible scenario is to assign forms to colleagues like tasks or to use with a workflow within InfoPath.
This article will explain how to fill in a dropdown list with the SharePoint Users
Download
HOW_TO_Populate_a_List_with_the_SharePoint_Users.pdf
Compatibilty
Most of the information will be showed in a table and using symbols.
InfoPath 2003 | Full support | |
InfoPath 2007 | Full support | |
Desktop Browser | No support | |
Mobile device browser | No Support |
Designing the Form
- Create a Receive Data Connection
- Go to Menu Tools -> Data Connections…
- Click the Add… button
- Select Receive data option
- Select SharePoint library or List
- Enter the Ur l of a SharePoint Site
- Select the Library or List
You can select any Library or Form, as we are going to change it later. The easiest way is to select a Library or list who has Title and ID as columns.
In case you don’t have Title, select Item
- Select only Title and ID (or Item and Id, see note above)
- Change the name of the Data Connection to SharePoint Users
Figure 1: Data Connection Wizard, selecting the columns
- Extract the Form Files
- Goto menu File -> Extract Form Files
- Select the folder to save the extracted form files
-
Figure 2: Browse for folder dialog box.
- Click Ok
- Close the InfoPath Designer
- Open the folder with the extracted files
- Open with Notepad the file Manifest.xsf
- Search for sharepointGuid
- Change the Guid with UserInfo
Code:
<xsf:dataObjects>
<xsf:dataObject name="SharePoint Users" schema="SharePoint Users.xsd" initOnLoad="yes">
<xsf:query>
<xsf:sharepointListAdapter siteUrl="http://mossqa.silversands.com/sites/Sandbox/infopath/" sharepointGuid="{799BD477-5183-4FAB-AE75-A9C45C870D4B}" infopathGroup="File_Attachments" queryAllowed="yes" submitAllowed="no" name="SharePoint Users">
<xsf:field sharepointName="Title" infopathName="Title"></xsf:field>
<xsf:field sharepointName="ID" infopathName="ID"></xsf:field>
</xsf:sharepointListAdapter>
</xsf:query>
</xsf:dataObject>
</xsf:dataObjects>
Change to
<xsf:dataObjects>
<xsf:dataObject name="SharePoint Users" schema="SharePoint Users.xsd" initOnLoad="yes">
<xsf:query>
<xsf:sharepointListAdapter siteUrl="http://mossqa.silversands.com/sites/Sandbox/infopath/" sharepointGuid="UserInfo" infopathGroup="File_Attachments" queryAllowed="yes" submitAllowed="no" name="SharePoint Users">
<xsf:field sharepointName="Title" infopathName="Title"></xsf:field>
<xsf:field sharepointName="ID" infopathName="ID"></xsf:field>
</xsf:sharepointListAdapter>
</xsf:query>
</xsf:dataObject>
</xsf:dataObjects>
- Right-click on Manisfest.xsf and Select design to re-open the form in Design mode
- Populate the Dropdown with the UserInfo
- Add a Dropdown list onto the Form
- Set the Field Name
- Select Look up values from an external datasource
- Select SharePoint Users in the Data Source drop down
- Select the repeating node using button next to the Entries textbox
- Set Value to @ID, by using the next to the Value textbox
- Set Value to @Name, by using the next to the Display name textbox
- Test the form, your doprodown box will be filled with the SharePoint Users
Conclusion
This article described how to populate a dropdown list box 8or other list boxes) with the users from SharePoint.
There are other ways of doing this, like using a web services, but this way you can keep everything in the design mode of the form
3 comments:
After this article I have only one hundred recordings. But recordings count is more than one hundred.I don't know than's happened. Help, please!
Many thanks for this post!
Thanks so much for writing this...
Seems simple enough but I have no data... any thoughts?
Post a Comment