CacheFormTemplate method
Collapse the table of content
Expand the table of content

Application.CacheFormTemplate method

Office 2013 and later

Examines the form template in the cache and, if necessary, updates it from the published location of the form template.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

public abstract void CacheFormTemplate(
	string formTemplateLocation
)

Parameters

formTemplateLocation
Type: System.String

Specifies the Uniform Resource Identifier (URI) of the form template. This parameter can be specified as a form definition (.xsf) file or a form template (.xsn) file.

ExceptionCondition
FileNotFoundException

The form template file cannot be found.

ArgumentNullException

The parameter passed to this method is a null reference (Nothing in Visual Basic).

ArgumentException

The parameter passed to this method is not valid. For example, they are of the wrong type or format.

If the form template that currently exists in the cache matches the form template from the published location, no caching takes place. If the computer is offline and the form is already in the cache, the cache is kept and no update will occur.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

In the following example, the CacheMyFormTemplates custom function loops through the location for each the form template specified in the forms array and passes that value to the CacheFormTemplate method for evaluation.

private string[] _forms = 
{ 
   @"\\MyServer\MyForms\MyForm.xsn", 
   @"\\MyServer\MyForms\manifest.xsf" 
};

private void someFunction()
{
...
   CacheMyFormTemplates(_forms);
...
}

private void CacheMyFormTemplates(string[] forms)
{ 
   foreach (string form in forms)
   {
      this.Application.CacheFormTemplate(form);
   }
}

Show:
© 2016 Microsoft