Saving the form without submit - InfoPath Dev
in

InfoPath Dev

Saving the form without submit

Last post 02-23-2012 02:17 PM by ramat. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-27-2008 07:21 AM

    • remeto
    • Not Ranked
    • Joined on 07-31-2008
    • Posts 9

    Saving the form without submit

    Hello ,

    is there a way to save a "browser enabled infopath form" to a "sharepoint document library" without submiting it. I don't wanto to submit it beacuse there are controls that have validation checks. But i don't want to check validation, just i wanto to save it . I found this walkthrough but it submits the form so validation check occurs.

     Thanks for your help...

     remeto

  • 08-27-2008 07:57 AM In reply to

    • remeto
    • Not Ranked
    • Joined on 07-31-2008
    • Posts 9

    Re: Saving the form without submit

    I tried this, 

    SPWeb
    web = SPContext.Current.Web;
    SPListCollection collLists = web.Lists;
    byte[] fileBytes = Encoding.ASCII.GetBytes(this.MainDataSource.CreateNavigator().OuterXml);

    foreach (SPList oList in collLists)
    {
        
    if (oList.BaseType == SPBaseType.DocumentLibrary)
         {
                 SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary)oList;
                 if (oDocumentLibrary.Title == "Application Template Forms")
                 {
                        SPFile myFile = oDocumentLibrary.RootFolder.Files.Add("xxx.xsn", fileBytes, true);
                        myFile.Update();
                        break;
                 }
         }
    }

     

    but it gives this error (my form is full trusted and signed digitally); 

    "The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

    Microsoft.SharePoint.SPException: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. ---> System.Runtime.InteropServices.COMException (0x8102006D): The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
    at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
    at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
    --- End of inner exception stack trace ---
    at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
    at Microsoft.SharePoint.SPFileCollection.AddInternal(String urlOfFile, Object file, PutFileOpt fileOpt, String createdBy, String modifiedBy, Int32 createdByID, Int32 modifiedByID, DateTime timeCreated, DateTime timeLastModified, Object varProperties, String checkInComment, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
    at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file, Boolean overwrite, String checkInComment, Boolean checkRequiredFields, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage)
    at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file, Boolean overwrite, String checkInComment, Boolean checkRequiredFields)
    at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file, Boolean overwrite)
    at Fullapp_Formu_v5.FormCode.CTRL5_54_Clicked(Object sender, ClickedEventArgs e)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<>c__DisplayClassa.<add_Clicked>b__3()
    at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.<>c__DisplayClass6.<add_Clicked>b__2(Object sender, ClickedEventArgs e)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.FireClickedEvent(Object sender, ClickedEventArgs args)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.<>c__DisplayClass2.<>c__DisplayClass5.<Click>b__1()
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)

    An entry has been added to the Windows event log of the server.
    Log ID:5337"

  • 08-27-2008 07:57 AM In reply to

    • remeto
    • Not Ranked
    • Joined on 07-31-2008
    • Posts 9

    Re: Saving the form without submit

    No MVP around ?

  • 08-27-2008 08:44 AM In reply to

    • remeto
    • Not Ranked
    • Joined on 07-31-2008
    • Posts 9

    Re: Saving the form without submit

    I solved the problem by turning off the "Web Page Security Validation". Any other ways to do it?

  • 08-28-2008 01:04 AM In reply to

    • remeto
    • Not Ranked
    • Joined on 07-31-2008
    • Posts 9

    Re: Saving the form without submit

    When i save the form with the code i wrote above i can't open the InfoPath Form in Browser. But if i save it with submitting(FileSubmitConnection) i can. So i check out if i can submit the form without validation. And here is the bloody tricky way to do that...

    http://blogs.msdn.com/infopath/archive/2006/10/09/Do-it-anyway_3A00_-Submitting-with-Data-Validation-errors.aspx

    I hope this thread helps someone someday...

  • 02-23-2012 02:17 PM In reply to

    • ramat
    • Not Ranked
    • Joined on 02-23-2012
    • Posts 1

    Re: Saving the form without submit

     

    Save the file as "xxx.xml" instead "xxx.xsn"

     

     

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