Introduction
We recently migrated InfoPath Forms from SharePoint On-Premises to SharePoint Online for a Postal and Parcel company based out of Melbourne, Victoria, Australia. In this migration, we updated all the data connections of the InfoPath Forms for compatibility with SharePoint Online. So, in this blog, we will explore one of the data connections and will learn how to get Current User Information in InfoPath form using the SOAP web service with SharePoint Online (Office 365).
Steps to get the current user details.
Step 1: Open your InfoPath form in InfoPath Designer. Open “Data Connection”, then click on the "Add" button.
Step 2: It will open a new "Data Connection Wizard", select "Create a new connection to:" and “Receive data” and Click on the “Next” button.
Step 3: Select “SOAP Web Service” and click on the “Next” button.
Step 4: Provide your URL and click on the “Next” button.
Replace your URL with this ({yoursharepointsite}/_vti_bin/UserProfileService.asmx).
Step 6: Click on the “Next” button.
Step 7: Click on the “Next” button.
Step 8: Provide your connection name, select “Automatically retrieve data when
form is opened” and click on the “Finish” button. “Connection
Wizard” will be closed automatically.
Step 9: In the “Data
Connection” window new connection will be displayed, close the connection window.
Step 10: Add
a new "Text Field" in the Fields panel. For adding text field, right-click on my fields and select the "Add" option.
Step 11: New popup will be opened, provide the name and click on the "OK" button. Here we have provided the "CurrentUser" Name to the text field.
Step 12: New field will be added in the fields panel, now right-click on the newly added field and select textbox.
Step 13: New textbox will be added to the form.
Step 14: Right-click on the textbox and select “Text
Box Properties”.
Step 16: Once you
click on the formula button "Insert Formula" popup will get opened, then select "Insert
Field or Group" option.
Step 17: "Select Field or Group" popup will be opened, then explore Fields dropdown and select "GetUserProfileByName" connection.
Step 19: "Filter
Data" dialog box opens, then click on the "Add" button.
Step 20: Now
“Specify Filter Conditions” dialog opens, from that expand the left drop-down
and select the “Select a Field or Group” option.
Step 21: In the
new dialog select "Name" filed of the "Property Data" and click on "OK".
Save the form and open it in preview mode. When the form will be loaded, the Display Name will be set in the "CurrentUser" textbox as shown below.
Conclusion
This is how we can get current user information details in InfoPath form using SOAP web service with SharePoint Online (Office 365).
No comments:
Post a Comment