FormsService.FormTemplates Property
Gets a collection of all administrator approved, browser-enabled form templates deployed to the server farm.
Namespace: Microsoft.Office.InfoPath.Server.Administration
Assembly: Microsoft.Office.InfoPath.Server (in Microsoft.Office.InfoPath.Server.dll)
Syntax
'Declaration
Public ReadOnly Property FormTemplates As FormTemplateCollection
Get
'Usage
Dim instance As FormsService
Dim value As FormTemplateCollection
value = instance.FormTemplates
public FormTemplateCollection FormTemplates { get; }
Property Value
Type: Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection
A FormTemplateCollection collection.
Remarks
The FormTemplateCollection collection represents all administrator approved form templates on the server farm. It does not include browser-enabled user form templates or form templates deployed to site collections as SharePoint content types.
Examples
The following examples write the count of administrator approved form templates to the console.
Visual Basic
Dim LocalFormsService As FormsService
Dim LocalFarm As SPFarm
Dim FormTemps As Integer
Try
LocalFarm = SPFarm.Local
LocalFormsService = LocalFarm.Services.GetValue(Of FormsService)(FormsService.ServiceName)
FormTemps = LocalFormsService.FormTemplates.Count()
Console.WriteLine("Number of form templates: " & FormTemps.ToString())
Console.Write("Press Enter to Continue")
Console.ReadLine()
Catch ex As Exception
Console.WriteLine("Error: " + ex.Message)
Console.Write("Press Enter to Continue")
Console.ReadLine()
End Try
C#
FormsService localFormsService;
SPFarm localFarm = SPFarm.Local;
Int16 formTemps;
try
{
localFormsService = localFarm.Services.GetValue<FormsService>(FormsService.ServiceName);
formTemps = (Int16)localFormsService.FormTemplates.Count;
Console.WriteLine("Number of form templates: " + formTemps.ToString());
Console.Write("Press Enter to Continue");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
Console.Write("Press Enter to Continue");
Console.ReadLine();
}