how to get the filename of a xsn file - InfoPath Dev
in

InfoPath Dev

how to get the filename of a xsn file

Last post 09-29-2011 07:26 AM by gufan. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-07-2011 07:24 AM

    • gufan
    • Not Ranked
    • Joined on 09-07-2011
    • Posts 4

    how to get the filename of a xsn file

     Hi.

    I already found a way to get the xml filename from the InfoPath Filler. I used The _Application3, Window2  and _XDocument3 interfaces for this.

    But i would also like to have the filename of the xsn file. There is a GetSolutionURI() method in the _Application3 interface that sounds like what i would need. But for getting out something of this i need a cacheID and in don't know where is should get this from.

    So my question is: how do i get the filename of the xsn file that is currently opened by the InfoPath Designer?

  • 09-07-2011 08:12 AM In reply to

    Re: how to get the filename of a xsn file

    I'm not aware of any way to get the XSN filename when running a form in preview mode, but you can use thisXDocument.Solution.URI to get it in published forms.

    It's also possible to codelessly extract this value from the form's processing instructions, but here again, this will only work for published forms.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-07-2011 08:43 AM In reply to

    • gufan
    • Not Ranked
    • Joined on 09-07-2011
    • Posts 4

    Re: how to get the filename of a xsn file

    This would require that i have opened the Filler with a document based on the xsn file, right?

    That will not work for my needs. I want to save the xsn file like the standard save functionality (+ doing extra things with the file afterwards). I don't understand why there shouldn't be a way to do this. The only reason for me would be a misconception.

  • 09-07-2011 11:57 AM In reply to

    Re: how to get the filename of a xsn file

    So, you're saving it to a folder and then having people double click on it to open, right? Then, you want to show the filename somewhere in the form. Is that right?

    I think Jimmy's suggestion to use the processing-instruction might work. Search for that. There should be a blog post that describes how to do it.

    Patrick Halstead
    Project Manager at Qdabra
  • 09-07-2011 11:22 PM In reply to

    Re: how to get the filename of a xsn file

    There probably is some misconception going on here.

    In this sentence,

    This would require that i have opened the Filler with a document based on the xsn file, right?

    Are you asking if you would have to open the Filler with an .XML document created from that XSN?  If so, that is not the case.  If you open the XSN itself in the Filler (as opposed to Preview mode), then you should be able to retrieve the XSN name and path.

    There are two ways to save an XSN from the Designer.  Save/Save As is for saving your "dev" version of the XSN, that you plan to reopen later and work on.  When you want to save out the XSN for other people to open it in the Filler and create forms with it, you should use the Publish feature.  You can use this to publish the form to a local folder or a network share.  Once you've published it, people can just double-click it to open it in the Filler.

    Maybe the Save vs. Publish part is what's causing the confusion here?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-29-2011 06:40 AM In reply to

    • gufan
    • Not Ranked
    • Joined on 09-07-2011
    • Posts 4

    Re: how to get the filename of a xsn file

    Thank you for your answers.

    How about doing both?
    Saving the dev version of the XSN and the published files sounds both very useful to me.
    When i open the XSN file in the filler, all i get is an XML when i save the file with my addin, not the XSN. I know that i can retrieve the XSN file name and path but this is somewhat complicated for the user.
    Is it possible to add an option to the Publish menu?

  • 09-29-2011 07:09 AM In reply to

    Re: how to get the filename of a xsn file

    I'm having trouble understanding what it is that you're trying to do.

     Could you describe your scenario a bit more clearly?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-29-2011 07:26 AM In reply to

    • gufan
    • Not Ranked
    • Joined on 09-07-2011
    • Posts 4

    Re: how to get the filename of a xsn file

     Okay.

    I have a document managment software here that is also able to do version control. Some applications, like all microsoft office applications, have an addin to directly interact with the DMS. This means that documents from all these office application can directly be stored in the DMS. InfoPath was missing until now but we might need it in the future so I am trying to integrate it. And of course we do not only want to save the XML files that are produced with the Filler, but also the designs that are used for this. Of course there is a way to get all these files inside the DMS without the integration, but it's easier and more intuitive to directly do it in the office application without the need to save it on the hard disc first and then add it to the DMS afterwards.

    So in the end it would be nice if I could save the template files into the DMS and when i open it with the Filler from within the DMS (that works perfectly), to also save the XML file produced into the DMS directly. Everything without the need of saving anything to the hard disc or anything like that.

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