Partilhar via


SPServiceApplication.MigrateUserAccount Method

Migrates a user account in Microsoft SharePoint Foundation to a new login name.

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

Syntax

'Declaration
Protected Friend Overridable Function MigrateUserAccount ( _
    oldPrincipalName As String, _
    newPrincipalName As String, _
    enforceSidHistory As Boolean _
) As Boolean
'Usage
Dim oldPrincipalName As String
Dim newPrincipalName As String
Dim enforceSidHistory As Boolean
Dim returnValue As Boolean

returnValue = Me.MigrateUserAccount(oldPrincipalName, _
    newPrincipalName, enforceSidHistory)
protected internal virtual bool MigrateUserAccount(
    string oldPrincipalName,
    string newPrincipalName,
    bool enforceSidHistory
)

Parameters

  • oldPrincipalName
    Type: System.String

    A string that contains the old login name.

  • newPrincipalName
    Type: System.String

    A string that contains the new login name.

  • enforceSidHistory
    Type: System.Boolean

    true to query Active Directory for the SID history attribute to ensure that the new login name corresponds to the old one; otherwise, false.

Return Value

Type: System.Boolean
true if the service migrated the user; otherwise, false.

Remarks

Service applications that store group account names should override this method in order to rename those groups in response to an administrator action.

If an entry for the new login name already exists, it is deleted to allow this change.

See Also

Reference

SPServiceApplication Class

SPServiceApplication Members

Microsoft.SharePoint.Administration Namespace