InfoPath form running on SharePoint 2016 gives error: The remote server returned an error: (401) Unauthorized, while try to query _vti_bin/UserGroup.asmx

SharePoint Guys 26 Reputation points
2021-10-04T20:47:29.357+00:00

Hi Expert,

I am converting an InfoPath form from SP2010 into SP2016.

In SP2016, the SharePoint web application (http://sp2016dev:7000) is using Claims Based Authentication.

I deployed the InfoPath form to http://sp2016dev:7000. When I opened the form in IE 11, I received the following error:
An error occurred while trying to connect to a Web service.

An entry has been added to the Windows event log of the server. 
Log ID:5566
Correlation ID:a8e2f59f-4e46-a01b-d1df-6f3a0124b5bb
--------------------------------------------------------------------------------
An error occurred while trying to connect to a Web service.
An entry has been added to the Windows event log of the server. 
Log ID:5566
Correlation ID:a8e2f59f-4e46-a01b-d1df-6f3a0124b5bb 

I checked the Windows Event Log, the error shows:

The following query failed: GetGroupCollectionFromUser (User: 0#.w|dev\devaccount07, Form Name: SD407 Form , IP: , Connection Target: http://sp2016dev:7000/site/infopathForms/Data_Connection_Library/WS_GetGroupCollectionFromUser.udcx, Request: http://sp2016dev:7000/_layouts/15/FormServer.aspx?XsnLocation=/site/infopathForms/FormServerTemplates/SD407 Form.xsn&ClientInstalled=false&Source=http://sp2016dev:7000/site/infopathForms/FormServerTemplates/Forms/All%2520Forms.aspx?InitialTabId=Ribbon%252EDocument&VisibilityContext=WSSTabPersistence, Form ID: urn:schemas-microsoft-com:office:infopath:SD407 Form: Type: DataAdapterException, Exception Message: The remote server returned an error: (401) Unauthorized.
The remote server returned an error: (401) Unauthorized.)

About dev\devaccount07:

  • The dev\devaccount07 account is the site collection admin account. I browse the SharePoint site using this account.
  • The userName() function inside the InfoPath form returns "i:0#.w|dev\devaccount07". I note that the above event log shows the account is "0#.w|dev\devaccount07", i.e. missing the prefix "i:"

.

I guess, probably I am wrong:
When the InfoPath form sends a web service request to http://sp2016dev:7000/site/infopathForms/_vti_bin/UserGroup.asmx through the Data Connection library (http://sp2016dev:7000/site/infopathForms/Data_Connection_Library/WS_GetGroupCollectionFromUser.udcx), the user account "0#.w|dev\devaccount07" cannot be authenticated because it missed the prefix "i:"; i.e. it should be "i:0#.w|dev\devaccount07".

I google the solution for days; however, I still don't find any solution.

Please kindly help.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,616 Reputation points
    2021-10-05T08:43:54.273+00:00

    Hi @SharePoint Guys
    When you use Claims-based authentication, your user name is prefaced by “0#.w|”. So for example, if your user name is SuesDomain\jdoe then your Claims-based user token will be, without the quotes: “0#.w|SuesDomain\jdoe”

    Howerver, InfoPath can’t handle that, or more specifically, the UserProfile.asmx method GetUserProfileByName method can’t handle that. InfoPath tries to pass in your Claims-based user token instead of your domain\User Name.

    For more information and solutions, you could refer to:
    https://suehernandez.wordpress.com/2013/10/11/sharepoint-2013-infopath-claims-getuserprofilebyname/
    https://sharepoint.stackexchange.com/questions/191449/infopath-calls-webservice-log-id5566-401-unauthorized

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.