File downloaded from website doesn't always open in Infopath - InfoPath Dev
in

InfoPath Dev

File downloaded from website doesn't always open in Infopath

Last post 10-05-2010 01:57 AM by Graeme. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-24-2010 02:48 AM

    File downloaded from website doesn't always open in Infopath

    I am downloading an Infopath form as an xml string from IIS and want it to open in Infopath. I set the ContentType to "application/ms-infopath.xml" (not sure where I got that from).

    On some machines it is fine, on others the xml opens in the browser, or in Visual Studio or some other xml editor, even though Infopath is present.

    1. Who keeps the list of valid content types?  Is this a valid MIME type for Infopath?
    2. What does the OS or browser do with it?  It would appear it is only looking for the file association and not doing anything with the MIME type.
    3. How can I force this XML to open in Infopath even if the user has some other application associated with .xml files?

    Here is the code - dead simple:

       Response.ClearHeaders();
       Response.ClearContent();
       Response.ContentType = "application/ms-infopath.xml";
       Response.AppendHeader("Content-disposition", "attachment; filename=" + Name);
       Response.Write(InfopathDoc);
    Filed under:
  • 09-27-2010 01:47 PM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    On the machines where InfoPath is installed but the XML opens in the other XML editor have you already tried to make sure that InfoPath is set as the default XML editor? 

    Also, this blog post from 2007 that Shiraz has might help, there is a way via script to ensure that InfoPath does open the XML, perhaps this might help: http://www.infopathdev.com/blogs/shiraz/archive/2007/08/16/best-way-to-launch-forms-from-web-pages.aspx

    Ted

  • 09-27-2010 11:59 PM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    Yes, changing the setting on the machines to make Infopath the default xml editor fixes this - but I can never be sure users won't install other software that usurps it again.  Besides, relying on a 3 character file name seems so 1980's.  What is the purpose of setting the MIME type if it is ignored?

    I looked at Shiraz article, but that is only for xsn template files.  I need to open the xml file in Infopath, or rather the xml being streamed from the web server, as the file is stored in SQL Server.

     Any other ideas?

  • 10-01-2010 06:49 AM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    Still no-one there with an opinion/explanation?  I tried changing the mime type to text/xml and the xml simply opens in the Internet Explorer window - the download dialog lists the type as "xml file".  Using the above mime type, IE correctly identifies the file as Infopath, yet I still have the 2003 vs 2007 issue...

    IE download dialog

  • 10-01-2010 07:23 AM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    What exactly is the InfoPath 2003 v 2007 issue you mention?

    I see problems with folks who have both 2003 and 2007 installed on their machine, InfoPath often does't know how to open that file (or gets confused about what version to open it in) and throws an error

  • 10-03-2010 11:51 PM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    Yes, we have 2003 & 2007 installed. All PCs should be set to open 2007 by default but some try to use 2003 and get an error.  Some even open the xml in the browser, and I assume if people install another xml program it will usurp the file extension (on my PC sometimes it opens in Visual Studio). 

    I need to know which registry entries I need to tweek to ensure IP 2007 is associated with xml/xsn files.  If you know, that would be great.

  • 10-04-2010 07:13 AM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    You can use the EditDocument2 method on the SharePoint.OpenXMLDocuments.1 object described in Shraz's post to open XML files.

    http://msdn.microsoft.com/en-us/library/cc264018.aspx

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-05-2010 01:57 AM In reply to

    Re: File downloaded from website doesn't always open in Infopath

    I don't actually have an xml file though - the xml is stored in sql server and is simply being streamed to the client in a Response.Write call.

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