<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: how to create file in the same directory as InfoPath Template?</title><link>https://www.infopathdev.com:443/forums/thread/69937.aspx</link><pubDate>Thu, 01 Sep 2011 16:59:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:69937</guid><dc:creator>jcmoon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/69937.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=69937</wfw:commentRss><description>thanks for your help!

That&amp;#39;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.</description></item><item><title>Re: how to create file in the same directory as InfoPath Template?</title><link>https://www.infopathdev.com:443/forums/thread/69904.aspx</link><pubDate>Wed, 31 Aug 2011 22:01:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:69904</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/69904.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=69904</wfw:commentRss><description>&lt;p&gt;So your issue is with the StreamWriter in your Loading event?&lt;/p&gt;
&lt;p&gt;You should be able to get the template&amp;#39;s publish path with this.Template.URI.ToString(). Is the form opened from a network share? You&amp;#39;ll have to do a little clean-up - run in debug so you can see what the value looks like.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: how to create file in the same directory as InfoPath Template?</title><link>https://www.infopathdev.com:443/forums/thread/69903.aspx</link><pubDate>Wed, 31 Aug 2011 21:22:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:69903</guid><dc:creator>jcmoon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/69903.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=69903</wfw:commentRss><description>okay that didn&amp;#39;t work well, i attached it.</description></item><item><title>Re: how to create file in the same directory as InfoPath Template?</title><link>https://www.infopathdev.com:443/forums/thread/69900.aspx</link><pubDate>Wed, 31 Aug 2011 21:09:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:69900</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/69900.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=69900</wfw:commentRss><description>&lt;p&gt;Hey there - what&amp;#39;s your code look like now?&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>how to create file in the same directory as InfoPath Template?</title><link>https://www.infopathdev.com:443/forums/thread/69722.aspx</link><pubDate>Fri, 26 Aug 2011 21:05:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:69722</guid><dc:creator>jcmoon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/69722.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=69722</wfw:commentRss><description>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</description></item></channel></rss>