共用方式為


SPFarm.MigrateUserAccount Method

Migrates a user account in SharePoint Foundation to a new login name and binary ID.

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

Syntax

'Declaration
Public Sub MigrateUserAccount ( _
    oldLogin As String, _
    newLogin As String, _
    enforceSidHistory As Boolean _
)
'Usage
Dim instance As SPFarm
Dim oldLogin As String
Dim newLogin As String
Dim enforceSidHistory As Boolean

instance.MigrateUserAccount(oldLogin, _
    newLogin, enforceSidHistory)
public void MigrateUserAccount(
    string oldLogin,
    string newLogin,
    bool enforceSidHistory
)

Parameters

  • oldLogin
    Type: System.String

    A string that contains the old login name.

  • newLogin
    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.

Remarks

If an entry for the new login name already exists, it is deleted to allow this change. The following entities are updated in the entire server farm: site collection users in the UserInfo tables, people lists, and security policies.

See Also

Reference

SPFarm Class

SPFarm Members

Microsoft.SharePoint.Administration Namespace