Button To Save Document - InfoPath Dev
in

InfoPath Dev

Button To Save Document

Last post 07-17-2010 06:47 AM by Skarn. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-13-2010 01:50 PM

    Button To Save Document

    I have added a button to my InfoPath 2007 document that I want to execute a save to a certain file path name with a certain file. When I click it nothign happens. What am I missing in my code?  I have similar logic in the save code for the form and it works.  The errors I get in MSVisual Studio is....

     

    Microsoft.Office.InfoPath.ClickedEventArgs' does not contain a definition for "PerformSaveOperation'

    The name 'RequisitionNumber' does not exist in the current context

    Microsoft.Office.InfoPath.ClickedEventArgs' does not contain a definition for "PerformSaveOperation'

    public void CTRL139_5_Clicked(object sender, ClickedEventArgs e)

    {

    // Write your button code here.

    {string RequisitionNumber = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Header/my:RequsitionNumber", NamespaceManager).InnerXml;

    { this.SetSaveAsDialogLocation(@"\\ccplm\sw6\req\");

    this.SetSaveAsDialogFilename(RequisitionNumber);

    }

    e.PerformSaveOperation();

    }

    {

    this.SetSaveAsDialogLocation(@"\\ccplm\sw6\req\");this.SetSaveAsDialogFilename(RequisitionNumber);

    e.PerformSaveOperation();

    // e.CancelableArgs.Message = "This functionality has been disabled.";

    // e.CancelableArgs.MessageDetails = "Only new forms can use the 'Save As' functionality.";

    }

    }

    }

    }

     

    Mlhauburn
    "There's no crying in baseball!"
  • 05-13-2010 11:04 PM In reply to

    Re: Button To Save Document

    why dont u try

    this.save();

    one more thing save operation is not supported in browser enabled forms

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 05-14-2010 06:43 AM In reply to

    Re: Button To Save Document

    Thank you for the suggestion, unfortunately it still didn't work.  Using your suggested code I now get an error reading "'Form Name' does not contain a definition for 'save'".

    ( First let me say that I am a total noob at this coding, I am learning as I go.  So please be patient with me.  Thanks for understanding)

     Can you give me an example of how the code should look?  I am using InfoPath 2007 and C# code (set up accordingly in TOOLS>FORM OPTIONS).  I am working with the C# code in MS Visual Studio 2005 Tools for Applications.

     Again, thank you for any help you can offer.  You past suggestion have always helped, and thank you for them.

    Mlhauburn
    "There's no crying in baseball!"
  • 05-14-2010 07:20 AM In reply to

    Re: Button To Save Document

    I finally got it working,  but ran into another snag.

     During DEBUG I tells me know that it can't find the file name.  The same code (see first message) works when I just do a 'save as' through the menu options but when I use my button it stops at e.PerformSaveOperation();

     The error is COMException was unhandled by user code

    The form does not have a file name.

     I added a break point and see where it steps through my set file name action but am not sure why it fails at the perfom save operation.

     Any ideas?

    Mlhauburn
    "There's no crying in baseball!"
  • 05-14-2010 10:50 PM In reply to

    Re: Button To Save Document

    e.PerformSaveOperation();

    is supported by objects of SaveEventArgs, to perform this operation

    e should be of object type SaveEventArgs , which is not the case here.

    is your form browser enabled?

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 05-21-2010 09:47 AM In reply to

    Re: Button To Save Document

    My form is not browser enabled.

    Mlhauburn
    "There's no crying in baseball!"
  • 07-17-2010 06:47 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Button To Save Document

    I can't/don't use C# (or whatever it is) in my forms - but you could try the same concept I use to 'submit a form to a file'.

    Use an object model like File System Object to create a text file and just save the XDocument.xml property to it. Tada.

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