Getting form template location at runtime - InfoPath Dev
in

InfoPath Dev

Getting form template location at runtime

Last post 10-20-2008 08:22 AM by sturge. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-17-2008 09:09 AM

    • sturge
    • Not Ranked
    • Joined on 05-06-2008
    • Posts 4

    Getting form template location at runtime

    Hi,

    I have an InfoPath form that is fully-trusted and running in client mode.  I need to get the path to the form template files in the cache at runtime, so that I can access some files that were bundled with the template when it was built.  The following lines of code were inserted into an on-click event handler for a button on the form:

    string cacheID = Application.ActiveWindow.XmlForm.Template.CacheId;

    string path = Application.GetFormTemplateLocation(cacheID);

    MessageBox.Show(path);

    By all indications, this should get the path to the template files in the cache.  However, the GetFormTemplateLocation function always returns a null string.  I verified the cacheID that I'm passing, for example, "15e47cf421a45cde$" is the cacheID, and the folder

    C:\Documents and Settings\User1\Local Settings\Application Data\Microsoft\InfoPath\FormCache2\DF6D4982.118\15e47cf421a45cde$

    exists on the machine, and contains all of the template files. 

    Does anyone have any idea why the GetFormTemplateLocation function is returning a null string?

    Thanks.

  • 10-17-2008 10:43 PM In reply to

    Re: Getting form template location at runtime

    Hi,Use the following code.string cacheID = this.Application.ActiveWindow.XmlForm.Template.CacheId; string path = this.Application.GetFormTemplateLocation(cacheID);MessageBox.Show(path);Also go through the following link.http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.application.getformtemplatelocation(VS.80).aspx 
    Swathip
    www.ggktech.com
  • 10-20-2008 08:22 AM In reply to

    • sturge
    • Not Ranked
    • Joined on 05-06-2008
    • Posts 4

    Re: Getting form template location at runtime

    Hi,

    The code you suggested is the same as the code I already tried (check my intial post again).  And the first thing I did was look up GetFormTemplateLocation on MSDN, to no avail.

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