Exporting InfoPath form as PDF to a network file share - InfoPath Dev
in

InfoPath Dev

Exporting InfoPath form as PDF to a network file share

Last post 02-02-2016 12:54 PM by jambou9182. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-02-2016 12:27 PM

    Exporting InfoPath form as PDF to a network file share

    I have coded a button in my form that exports the current view in PDF format to a file share.  The filename is auto generated based on a field in my form called "Filename".  I want to also auto generate the file share location, instead of hard coding it.

    Here is my C# code that has the network share hard coded in:

    string Filename = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:BaseTemplateFields/my:Filename", this.NamespaceManager).Value;
                this.CurrentView.Export(@"\\Sharename\Folder\" + Filename + ".pdf", Microsoft.Office.InfoPath.ExportFormat.Pdf);

    I want to replace "\\Sharename\Folder\" with a field from my form called "Location", so i tried this:

     string Filename = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:BaseTemplateFields/my:Filenameform", this.NamespaceManager).Value;
     string Location = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:BaseTemplateFields/my:Location", this.NamespaceManager).Value;
                this.CurrentView.Export(@ Location + Filename + ".pdf", Microsoft.Office.InfoPath.ExportFormat.Pdf);

    But it doesn't work. I'm missing something after the @ I think, but I'm not sure what.

    Any help would be appreciated.

    Thank you.

    Filed under:
  • 02-02-2016 12:45 PM In reply to

    Re: Exporting InfoPath form as PDF to a network file share

     You don't need the "@" anymore. See this Stack Overflow thread for an explanation: http://stackoverflow.com/questions/556133/whats-the-in-front-of-a-string-in-c

    Hilary Stoupa

  • 02-02-2016 12:54 PM In reply to

    Re: Exporting InfoPath form as PDF to a network file share

    It works!   Thank you so much!

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