FormsService.BrowserEnableUserFormTemplate Method

Browser-enables a browser-compatible form template that does not contain form code, require full trust, enable rendering on a mobile device, or use a data connection managed by a server administrator.

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

Syntax

'Declaration
Public Function BrowserEnableUserFormTemplate ( _
    solutionFile As SPFile _
) As ConverterMessageCollection
'Usage
Dim instance As FormsService
Dim solutionFile As SPFile
Dim returnValue As ConverterMessageCollection

returnValue = instance.BrowserEnableUserFormTemplate(solutionFile)
public ConverterMessageCollection BrowserEnableUserFormTemplate(
    SPFile solutionFile
)

Parameters

Return Value

Type: ConverterMessageCollection
Returns a collection of messages that describe the results of the form template conversion.

Remarks

A manifest (.xsf) file of a browser-compatible form template can be used in the solutionFile parameter if all supporting files are located in the same folder. For form templates that contain code, use the methods of the FormTemplateCollection collection and the FormTemplate object.

Examples

In the following code example, a file that has been uploaded to a form library is browser-enabled.

    Dim LocalFormsService As FormsService
    Dim LocalFarm As SPFarm = SPFarm.Local
    Dim LocalSite As SPSite = New SPSite("https://ServerName")
    Dim LocalWeb As SPWeb = LocalSite.AllWebs("SiteName")
    Dim LocalFile As SPFile
    Try
        LocalFormsService = LocalFarm.Services.GetValue(Of FormsService)(FormsService.ServiceName)
        LocalFile = LocalWeb.GetFile("FormLibrary/Forms/FormTemplate.xsn ")
        LocalFormsService.BrowserEnableUserFormTemplate(LocalFile)
        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;
    SPSite localSite = new SPSite("https://ServerName");
    SPWeb localWeb = localSite.AllWebs["SiteName"];
    try
    {
        localFormsService = localFarm.Services.GetValue<FormsService>(FormsService.ServiceName);
        SPFile localFile = localWeb.GetFile("FormLibrary/Forms/FormTemplate.xsn");
        localFormsService.BrowserEnableUserFormTemplate(localFile);
        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

FormsService Class

FormsService Members

Microsoft.Office.InfoPath.Server.Administration Namespace