Share via


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)

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