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.