다음을 통해 공유


SPFarmManagedAccountCollection.FindOrCreateAccount Method

Finds a managed account with specified user name or creates one if the managed account does not exist.

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

Syntax

'Declaration
Public Function FindOrCreateAccount ( _
    username As String _
) As SPManagedAccount
'Usage
Dim instance As SPFarmManagedAccountCollection
Dim username As String
Dim returnValue As SPManagedAccount

returnValue = instance.FindOrCreateAccount(username)
public SPManagedAccount FindOrCreateAccount(
    string username
)

Parameters

  • username
    Type: System.String

    The user name that identifies the account.

Return Value

Type: Microsoft.SharePoint.Administration.SPManagedAccount
The managed account matching the username.

Remarks

This method retrieves the account that matches the username, or creates one if the account does not exist and returns the new account.

See Also

Reference

SPFarmManagedAccountCollection Class

SPFarmManagedAccountCollection Members

Microsoft.SharePoint.Administration Namespace