共用方式為


SPFarm.Open Method (SqlConnectionStringBuilder, String, String)

NOTE: This API is now obsolete.

Returns a remote server farm based on the specified connection string, user name, and password. Obsolete. Use the Open() method that takes a passphrase.

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

Syntax

'Declaration
<ObsoleteAttribute("Use the SPFarm.Open method that takes a passphrase.",  _
    False)> _
Public Shared Function Open ( _
    connectionString As SqlConnectionStringBuilder, _
    user As String, _
    password As String _
) As SPFarm
'Usage
Dim connectionString As SqlConnectionStringBuilder
Dim user As String
Dim password As String
Dim returnValue As SPFarm

returnValue = SPFarm.Open(connectionString, _
    user, password)
[ObsoleteAttribute("Use the SPFarm.Open method that takes a passphrase.", 
    false)]
public static SPFarm Open(
    SqlConnectionStringBuilder connectionString,
    string user,
    string password
)

Parameters

  • user
    Type: System.String

    A String object that contains the user name for the server farm account that is used for the administrative site application pool and timer service.

  • password
    Type: System.String

    A String object that contains the password for the server farm account that is used for the administrative site application pool and timer service.

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

When a [T:System:String] object contains sensitive information such as a password, there is a risk that the information might be revealed after it is used because your application cannot delete the data from computer memory. You can provide the farmPassword parameter as a SecureString object, to help protect it from accidental or malicious exposure. See Open.

The user name and password that you provide must be associated with a domain account.

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 a 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