If you ever needed to get user information, in a claims
based authenticated web application (mixed authentication), by using the web
service method: GetUserProfileByName in InfoPath, (actually, it’s the only
method you can use, because all the other possible ways, and even the managed
code behind in InfoPath, they all work in the client mode, but never on the
browser!!!!!! since querying user profiles directly, in a mixed authenticated
web app isn’t possible!! it always give you the “unauthorized” error logged
whenever u try to run in from the browser!)
So, here’s what you gotta do:
1. You have to have a web application with Classic mode
authentication only in your farm, suppose this is its url: http://sp:4444/
2. Create a new Data Connection Library in the site that
hosts your InfoPath form (it’s a type of SharePoint library that stores
connection files, with a .udcx extension: these files are usually used for
cross-domain data connections.)
3. In your InfoPath form, Add a “Receiving Data” connection – From
a SOAP service – point it to the url of the user profiles service, in the Classic
authenticated web application (e.g.: http://sp:4444/_vti_bin/UserProfileService.asmx),
name it: GetUserProfileByName.
4. In the same Data Connections wizard, select the data connection:
GetUserProfileByName, and click on : “Convert to connection file”, and
type-in the url of your data connection library, and give a name for your data
connection file (e.g.: http://sp:2012/DataConnectionLibrary/GetUserProfileByName.udcx)
5. Go to the DataConnectionLibrary to make sure the new connection
file has been added, download a copy of It, and edit it to add/update the
following tag:
<udc:Authentication>
<udc:UseExplicit CredentialType="NTLM">
<udc:UserId>domain\adminUserName</udc:UserId>
<udc:Password>password</udc:Password>
</udc:UseExplicit>
</udc:Authentication>
6. Add the updated .udcx file back to the data connections library,
then click on the arrow next to the item’s Name to Approve it.
NB: This experience was taken from my colleague Malek El Zeeni
No comments:
Post a Comment