FormsService.FormTemplates FormsService.FormTemplates FormsService.FormTemplates FormsService.FormTemplates Property

Definition

Gets a collection of all administrator approved, browser-enabled form templates deployed to the server farm.

public:
 property Microsoft::Office::InfoPath::Server::Administration::FormTemplateCollection ^ FormTemplates { Microsoft::Office::InfoPath::Server::Administration::FormTemplateCollection ^ get(); };
public Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection FormTemplates { get; }
member this.FormTemplates : Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection
Public ReadOnly Property FormTemplates As FormTemplateCollection

Property Value

Examples

The following code examples write the count of administrator approved form templates to the console.

    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.<span class="label">FormTemplates</span>.Count()
        Console.WriteLine("Number of form templates: " &amp; 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
    FormsService localFormsService;
    SPFarm localFarm = SPFarm.Local;
    Int16 formTemps;

    try
    {
        localFormsService = localFarm.Services.GetValue&lt;FormsService&gt;(FormsService.ServiceName);
        formTemps = (Int16)localFormsService.<span class="label">FormTemplates</span>.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();
    }

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.

Applies to