how to create file in the same directory as InfoPath Template? - InfoPath Dev
in

InfoPath Dev

how to create file in the same directory as InfoPath Template?

Last post 09-01-2011 09:59 AM by jcmoon. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-26-2011 02:05 PM

    how to create file in the same directory as InfoPath Template?

    Hi! I wrote a C# program to export the contents of infopath form to tab delimited text file, and by default it creates the text file in the /bin/debug directory from the C# source code. I want the file to be created in the same directory as the Infopath form itself, which in this case is the desktop. Is there a way to find this out in C#? right now, the file is created here: C:\Users\jcmoon\Documents\InfoPath Projects\DRAFT_Single Cost Center Form v1_With1\bin\Debug I want the file to output in the same directory as the form that created it! Thanks for any help! James
  • 08-31-2011 02:09 PM In reply to

    Re: how to create file in the same directory as InfoPath Template?

    Hey there - what's your code look like now?

    Basically, you need to get the path of the form and then use it (less the file name) as the path where you save your file.

     

    Hilary Stoupa

  • 08-31-2011 02:22 PM In reply to

    Re: how to create file in the same directory as InfoPath Template?

    okay that didn't work well, i attached it.
  • 08-31-2011 03:01 PM In reply to

    Re: how to create file in the same directory as InfoPath Template?

    So your issue is with the StreamWriter in your Loading event?

    You should be able to get the template's publish path with this.Template.URI.ToString(). Is the form opened from a network share? You'll have to do a little clean-up - run in debug so you can see what the value looks like.

     

    Hilary Stoupa

  • 09-01-2011 09:59 AM In reply to

    Re: how to create file in the same directory as InfoPath Template?

    thanks for your help! That's not exactly what i was looking for: this.Template.URI.ToString() :file:///C:/Users/jcmoon/AppData/Local/Microsoft/InfoPath/Designer3/565bbd9ce2d346d9/manifest.xsf The form is opened from a PC, which in this case is located on the desktop, So i need to know how to get the path of the folder containing the form, which could be anywhere on the PC.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.