How to fix form cannot run the specified query error in InfoPath after migration to SharePoint 2019?

Philip Victor Jebaraj S 41 Reputation points
2021-02-11T05:42:15.43+00:00

Team - I am working in SharePoint 2019 migration with InfoPath code-behind from 2007 to 2013. In that UDCX file is used to connect to SharePoint to get the details from list. The following URL is used between the <udc:Query></udc:Query> tag.

http://spserver/sites/site1/subsite1/_vti_bin/owssvr.dll?Cmd=Display&amp;List={5C9C6066-52F4-481C-AC07-CE6DAF3819B2}&amp;XMLDATA=TRUE

The UDCX file is called from C# code as shown below.

FileQueryConnection connection = (FileQueryConnection)this.DataConnections[Constants.SummaryDataConnection];
            string queryURL = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}&SortField={3}", connection.FileLocation, "&FilterField1=LinkTitle&FilterValue1=", auditNumber, Constants.ActionNumberColumnName);
            connection.FileLocation = queryURL;
            connection.Execute();

I am getting the below error while the first line of C# is trying to execute.
"the form cannot run the specified query".

Kindly provide the solution to resolve this issue.

Thanks,
Philip

Microsoft 365 and Office SharePoint Server For business
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,126 Reputation points
    2021-02-12T07:57:55.81+00:00

    Hi @Philip Victor Jebaraj S

    It seems that InfoPath Form Services does not support claims based authentication. I find the informatio in this article:http://goodbadtechnology.blogspot.com/2013/12/migrate-browser-based-infopath-forms.html

    Exception: "The form cannot run the specified query."
    Inner Exception Details: "Unknown Error"

    The above exception is thrown when the code reaches FileQueryConnection.Execute(); if your contains the FileQueryConnection object.

    It appears that InfoPath Form Services does not support claims based authentication.


    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.


1 additional answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,126 Reputation points
    2021-02-12T07:16:25.67+00:00

    Hi @Philip Victor Jebaraj S

    After migration, please check if the URL is correct in the data connection. Sometimes the list GUIDs could have changed. Besides, you also have to change the host name in the url.

    You could open the url in the browser, check that if you could retrieve List data in XML format

    http://sp/sites/yoursite/_vti_bin/owssvr.dll?Cmd=Display&List={5C9C6066-52F4-481C-AC07-CE6DAF3819B2}&XMLDATA=TRUE  
    

    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.


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.