Compartilhar via


FormsService Class

Represents the top level entity of InfoPath Forms Services.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPersistedObject
      Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
        Microsoft.SharePoint.Administration.SPService
          Microsoft.Office.InfoPath.Server.Administration.FormsService

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

Syntax

'Declaration
<GuidAttribute("543DD7B9-6E48-438d-86D8-000000000000")> _
Public NotInheritable Class FormsService _
    Inherits SPService _
    Implements IBackupRestoreConfiguration, IBackupRestore
'Usage
Dim instance As FormsService
[GuidAttribute("543DD7B9-6E48-438d-86D8-000000000000")]
public sealed class FormsService : SPService, 
    IBackupRestoreConfiguration, IBackupRestore

Remarks

The FormsService object is an SharePoint Server 2010 shared service provider that extends the SPService object. Like all shared service providers, it is load-balanced and runs at the farm level. There is only one instance of the forms service per farm.

Examples

The following code example writes the forms service status to the console that the forms service is not available. References are required in the Visual Studio project to the [Microsoft.Office.Server], the [Microsoft.Office.InfoPath.Server], and the [Microsoft.SharePoint] assemblies.

Note

Browse for the [Microsoft.Office.InfoPath.Server] assembly at [drive]:\Program Files\Microsoft Office Servers\14.0\Bin.

For the example to work, Import statements are required for the

Microsoft.Office.Server, the Microsoft.Office.InfoPath.Server.Administration, and the Microsoft.SharePoint.Administration namespaces.

    Dim LocalFormsService As FormsService
    Try
        LocalFormsService = SPFarm.Local.Services.GetValue(Of FormsService)(FormsService.ServiceName)
        Console.WriteLine(LocalFormsService.Status.ToString())
    Catch ex As Exception
        Console.WriteLine("The forms service is not provisioned.")
    End Try

For the example to work, using statements are required for the

Microsoft.Office.Server, the Microsoft.Office.InfoPath.Server.Administration, and the Microsoft.SharePoint.Administration namespaces.

FormsService localFormsService;
    try
    {
        localFormsService = SPFarm.Local.Services.GetValue<FormsService>(FormsService.ServiceName);
        Console.WriteLine(localFormsService.Status.ToString());
    }
    Catch (Exception ex)
    {
        Console.WriteLine("The forms service is not provisioned.");
    }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

FormsService Members

Microsoft.Office.InfoPath.Server.Administration Namespace