FormTemplateCollection.VerifyFormTemplate Method

Verifies that the form template can be browser-enabled.

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

Syntax

'Declaration
Public Shared Function VerifyFormTemplate ( _
    solutionPath As String _
) As ConverterMessageCollection
'Usage
Dim solutionPath As String
Dim returnValue As ConverterMessageCollection

returnValue = FormTemplateCollection.VerifyFormTemplate(solutionPath)
public static ConverterMessageCollection VerifyFormTemplate(
    string solutionPath
)

Parameters

  • solutionPath
    Type: System.String
    The path and file name of the form template (.xsn) file.

Return Value

Type: Microsoft.Office.InfoPath.Server.Administration.ConverterMessageCollection
A collection of messages describing the results of the form template verification.

Examples

The following examples use the VerifyFormTemplate method to verify that a form template can be uploaded to the server. The converter messages returned from the form template converter are written to the console.

Visual Basic

    Dim LocalFormsService As FormsService
    Dim LocalFarm As SPFarm
    Dim SolutionPath As String = "C:\FormTemplates\FormTemplate.xsn"
    Dim VerifyMessages As New ConverterMessageCollection
    Dim ConverterMsg As ConverterMessage
    Try
        LocalFarm = SPFarm.Local
        LocalFormsService = LocalFarm.Services.GetValue(Of FormsService)(FormsService.ServiceName)
        VerifyMessages = FormTemplateCollection.VerifyFormTemplate(SolutionPath)
        For Each ConverterMsg In VerifyMessages
            Console.WriteLine(ConverterMsg.ShortMessage.ToString() & ": " & ConverterMsg.DetailedMessage.ToString())
        Next
        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;
    string solutionPath = "C:\\FormTemplates\\FormTemplate.xsn";
    ConverterMessageCollection verifyMessages;
    try
    {
        localFormsService = localFarm.Services.GetValue<FormsService>(FormsService.ServiceName);
        verifyMessages = FormTemplateCollection.VerifyFormTemplate(solutionPath);
        foreach (ConverterMessage convMessage in verifyMessages)
        {
            Console.WriteLine(convMessage.ShortMessage.ToString() + ": " + convMessage.DetailedMessage.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();
    }

See Also

Reference

FormTemplateCollection Class

FormTemplateCollection Members

Microsoft.Office.InfoPath.Server.Administration Namespace