Error when trying to open a form in Sharepoint - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Error when trying to open a form in Sharepoint

Last post 10-06-2020 01:54 PM by mklauss. 23 replies.
Page 2 of 2 (24 items) < Previous 1 2
Sort Posts: Previous Next
  • 09-25-2020 11:45 AM In reply to

    Re: Error when trying to open a form in Sharepoint

    Well - that's why I was asking about whether the form is in production. You don't have to have a specific group for the section - you can bind a section to another field or group in the schema. But, in InfoPath Forms Services (browser) forms my experience has been that deleting a field or group from the template actually causes additional schema validation errors. I guess what I'm not understanding is the complete inconsistency of the issue. I.e. - yesterday, you opened some XML files successfully. Without changing (or republishing? I'm not sure from your answer whether you republished the form between checking these files yesterday) the XSN (InfoPath form) the XML files won't open today. I don't understand if the PowerShell script that changes your files runs on all files - that is, did the XML files you successfully opened yesterday get touched at all by the PowerShell script? I guess if you are already running a script on all these files, you could just have it remove the submit element entirely, and bind that section in the form to something else...
    Hilary Stoupa

  • 09-25-2020 03:00 PM In reply to

    Re: Error when trying to open a form in Sharepoint

     Hmmm, I've never tried to bind a section to another group or field before. That sounds interesting. Maybe I'm misunderstanding your post or the definition of a template but the data that is deleted is only in a completed form that is published on Sharepoint. The inconsistency is driving me nuts also since I think I have it fixed and then it errors out again. I didn't publish the form until after I started getting errors again today so I'm not sure what if anything changed. The PowerShell script runs once to delete the address from the form stored in SharePoint right after it is sent there. That made me think of a new test to try, if I open up the form before the script runs which is withing 5-10 minutes after it is sent to Sharepoint and then after the address is deleted if it will make a difference. If it is that the script is causing the error by deleting data and messing up the form then I will have to look at other options. Thanks again Hilary, I appreciate your time and your insight.

  • 09-25-2020 03:09 PM In reply to

    Re: Error when trying to open a form in Sharepoint

    A template is an InfoPath form - the form itself, the XSN file that you work on in InfoPath Designer and publish. I had thought you were talking about removing the group from the schema in the XSN.
    Hilary Stoupa

  • 09-25-2020 03:21 PM In reply to

    Re: Error when trying to open a form in Sharepoint

    Okay thank you, more learning for me. I was thinking about removing the group but I have just run a test and think I have it isolated now. I submitted a new request which sends it to Sharepoint. I checked and was able to open up the form that resides in Sharepoint just fine. When the script ran and deleted the address I tried to open it again and it failed with the error. I haven't heard back from the PowerShell guy about whether he was able to replace the address with a period or something else yet but I am curious if replacing the address with some other character will fix the issue also.

  • 09-25-2020 03:43 PM In reply to

    Re: Error when trying to open a form in Sharepoint

    I don't think the error stems from the address replacement. I think it has to do with something in the way the file is re-saved from PowerShell. He might want to look into Xml.PreserveWhitespace - I'm wondering about setting that to false before loading the XML and then setting to true before re-saving might help with this. I'm going to test with that sample file you sent me and see.
    Hilary Stoupa

  • 09-25-2020 03:51 PM In reply to

    Re: Error when trying to open a form in Sharepoint

     Oh ok that is a good suggestion as well thanks.

  • 09-25-2020 03:53 PM In reply to

    Re: Error when trying to open a form in Sharepoint

     Okay, so I tried this approach:

    $xml = New-Object System.Xml.XmlDocument
    $xml.PreserveWhitespace = $false
    $xml.Load("C:\Users\Hilary Stoupa\Documents\~Temp\2020-09-22T09_02_19.xml")
    $xml.PreserveWhitespace = $true
    $xml.Save("C:\Users\Hilary Stoupa\Documents\~Temp\TST2020-09-22T09_02_19.xml")

     

     Basically, setting preserve whitespace to false, loading the doc, then saving after setting preserve whitespace to true, and that seemed to do the trick. Maybe worth having the person who wrote the script try this approach on a file or two and see if that addresses the issue. Here's a Stack Overflow reference: https://stackoverflow.com/questions/8160613/powershell-saving-xml-and-preserving-format/8160878#8160878

    And here is info on Xml.PreserveWhitespace:  https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmldocument.preservewhitespace?redirectedfrom=MSDN&view=netcore-3.1#System_Xml_XmlDocument_PreserveWhitespace

    Hilary Stoupa

  • 09-25-2020 04:21 PM In reply to

    Re: Error when trying to open a form in Sharepoint

     I was just reading up on xml whitespace and it s very interesting. Thank you for testing it and for the information, I think you have found the cause and solution. I will ask him to try that out and see what happens.

  • 10-06-2020 01:54 PM In reply to

    Re: Error when trying to open a form in Sharepoint

    I am still waiting for the powershell guy to test out your suggestions Hilary and will reply back when that is done and we can test it out.

Page 2 of 2 (24 items) < Previous 1 2
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.