共用方式為


SPFarm.Open Method (SqlConnectionStringBuilder, String, SecureString)

NOTE: This API is now obsolete.

Obsolete. Use the Open() method that takes a passphrase. Returns an object representing a remote SPFarm.

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, _
    username As String, _
    password As SecureString _
) As SPFarm
'Usage
Dim connectionString As SqlConnectionStringBuilder
Dim username As String
Dim password As SecureString
Dim returnValue As SPFarm

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

Parameters

  • username
    Type: System.String

    Contains the user name for the server farm account that is used for the administrative site application pool and timer service.

  • password
    Type: System.Security.SecureString

    Contains the password for the server farm account that is used for the administrative site application pool and timer service. The text is encrypted for privacy when it is being used, and deleted from computer memory when it is no longer needed.

Return Value

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

Exceptions

Exception Condition
InvalidOperationException

Obsolete. Use the Open() method that takes a passphrase.

ArgumentNullException

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

Remarks

The user name and password that are provided 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 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