How can I clear the InfoPath cache - InfoPath Dev
in

InfoPath Dev

How can I clear the InfoPath cache

Last post 11-30-2009 10:05 PM by Ashwin Bhagwat. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-14-2008 07:32 AM

    • cathy
    • Top 500 Contributor
    • Joined on 08-19-2007
    • Posts 38

    How can I clear the InfoPath cache

    Hi,

    I want to clear the infopath cache programmatically, I have followed the following discussion.

    http://www.infopathdev.com/forums/p/2526/25458.aspx#25458

    But, I am using C# as the coding language, so, can any body tell me how can I clear the infopath cache through C#?I tried converting the same code in to C# but, it is not working.

     

     

    Thanks

  • 01-15-2008 09:48 AM In reply to

    Re: How can I clear the InfoPath cache

    It is not intended for one to clear the InfoPath cache from within an InfoPath form.

    What are your intentions?

  • 01-21-2008 07:24 PM In reply to

    • cathy
    • Top 500 Contributor
    • Joined on 08-19-2007
    • Posts 38

    Re: How can I clear the InfoPath cache

    I am getting an error message when I am trying to open the infopath form from the sharpoint server form library. It is giving me the error: InfoPath cannot create a new or blank xml file. when I did search on the google, I got the solution for this as follows

    1. clear the infopath cache

    2. clear the browser's history.

    I can direct the infopath users in my company towards how to clear the browser's history. But, I cannot direct them to run that 'clearcache' command each time, they get this error.

     I would like to put the code for clearing the cache in the infopath Onload event.

    How can I achieve this?

     

  • 01-21-2008 09:24 PM In reply to

    Re: How can I clear the InfoPath cache

    Hi Cathy,

    As Greg said, clearing the cache is a measure of last resort when your InfoPath form template is not cached correctly. You don't need to use the command line tool to do this. Just go to Start->InfoPath and when you have the Getting Started dialog, Select All Forms on the left and then select the form that is causing the problem in your list. Click remove on the right. That will also clear your cache.

    Cache issues should be very rare. They do happen from time to time, but you shouldn't try to programmatically remove it from the cache. InfoPAth should automatically upgrade the form when it changes and this is one of the best features of InfoPath. Is your form domain trust? Where is it located - on a server? If you need to re-install the form every time, please consider using regform to create an MSI and sending your customers that. However, this is not *best*. Best practice is just to publish domain trust to a server and let InfoPath do autoupgrade.

    Cheers!

     

    Patrick Halstead
    Project Manager at Qdabra
  • 01-22-2008 02:41 PM In reply to

    Re: How can I clear the InfoPath cache

    You will want to first find out whether clearing the cache will even resolve the issue. It may not. Even if you can add cache clearing code to the OnLoad event--this is discouraged. It will slow down users when they load other forms (because they are not cached), and could potentially cause severe errors in the form just being opened (because it was just cached).

  • 11-30-2009 01:39 PM In reply to

    • mightytook
    • Not Ranked
    • Joined on 05-28-2008
    • Arlington, VA
    • Posts 8

    Re: How can I clear the InfoPath cache

    Here's how I did it from a standalone C# EXE. Not sure if you wanted it for an Infopath form or a standalone EXE.

    1. Add the directive "using System.Diagnostics;" at top.
    2. Add a reference to "Microsoft.Office.Interop.InfoPath.Application"

    // Open a new shell (as hidden) and kick-off Infopath with the cache clearing parms
    Process process = new Process();
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.FileName = "C:\\Program Files\\Microsoft Office\\Office12\\INFOPATH.EXE";
    process.StartInfo.Arguments = "/cache clearall";
    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    process.Start();
    process.WaitForExit();

    // Grab hold of the running Infopath app and close it
    Microsoft.Office.Interop.InfoPath.Application infopath2 = new Microsoft.Office.Interop.InfoPath.Application();
    infopath2.Quit(false);

    Hope that helps.
  • 11-30-2009 05:54 PM In reply to

    Re: How can I clear the InfoPath cache

    You took a mighty big stick to it. :)

    Patrick Halstead
    Project Manager at Qdabra
  • 11-30-2009 06:44 PM In reply to

    • mightytook
    • Not Ranked
    • Joined on 05-28-2008
    • Arlington, VA
    • Posts 8

    Re: How can I clear the InfoPath cache

    In retrospect, it does seem like a big stick. I was at wit's end with having a single form published to 21 libraries. When it came time to republish the form, we lost all promoted properties which then took 2 days for someone to get everything showing again. I did it once manually and vowed never to do that again so I wrote something to iterate through and get everything bubbled back up. The problem I had is that my exe kept complaining about locally cached templates, so I solved that by blasting away the local templates regularly with the code here. Crazy!
  • 11-30-2009 10:05 PM In reply to

    Re: How can I clear the InfoPath cache

    Infopath /cache clearall

    Ashwin B. | My Blog | Twitter | E-Mail

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