CacheSolution Method (Application Object)

Microsoft Office InfoPath

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

expression.CacheSolution(ByVal bstrSolutionURI As String)

expression    Required. An expression that returns a reference to an Application object.

bstrSolutionURI    Required String. The string that 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.

Security Level

3: Can be accessed only by fully trusted forms.

Remarks

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.

Note  This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

Example

In the following Visual Basic for Applications (VBA) example, the CacheSolution method of the Application object is used to cache a form template:

Public Sub CacheFormTemplate()

   Dim I As Integer
   Dim objApp As Object
   Dim aryForms(2) As String

   ' Create a reference to the Application object.
   Set objApp = CreateObject("InfoPath.Application")

   ' Populate the array with form template locations.
   aryForms(0) = "\\MyServer\MyForms\MyForm.xsn"
   aryForms(1) = "\\MyServer\MyForms\manifest.xsf"

   ' Loop through the array and cache the form templates.
   For I = 0 To UBound(aryForms) - 1
      objApp.CacheSolution(aryForms(I))
   Next I

End Sub