共用方式為


SPFarm.Open Method (String)

Returns an object that represents a remote server farm based on the specified connection string.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Shared Function Open ( _
    connectionString As String _
) As SPFarm
'Usage
Dim connectionString As String
Dim returnValue As SPFarm

returnValue = SPFarm.Open(connectionString)
public static SPFarm Open(
    string connectionString
)

Parameters

  • connectionString
    Type: System.String

    Contains the connection string for the configuration database of the remote server farm.

Return Value

Type: Microsoft.SharePoint.Administration.SPFarm
An SPFarm object that represents the remote server farm.

Exceptions

Exception Condition
ArgumentNullException

SqlConnectionStringBuilder object is a null reference (Nothing in Visual Basic).

Remarks

This method requires access to the remote farms configuration database. If the current user or process identity does not have permission to access the database, or if the local machine is not on the same network as the database, this call will fail with an exception of type SqlException and a message indicating that this is the case.

See Also

Reference

SPFarm Class

SPFarm Members

Open Overload

Microsoft.SharePoint.Administration Namespace