SPFarm.MigrateUserAccount method (Guid, String, String, Boolean)

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)

Syntax

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

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

Parameters

  • subscriptionId
    Type: System.Guid

    The GUID of the target subscription ID or Guid.Empty to target all subscriptions.

  • 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 and migration. The following entities are updated in the entire server farm: site collection users in the user information tables, people lists, and security policies.

This method is a tenant-aware version of the old method.

See also

Reference

SPFarm class

SPFarm members

MigrateUserAccount overload

Microsoft.SharePoint.Administration namespace