Share via


PortalAccountMigrationManager.MigrateAccount Method (String, String, Boolean)

Updates Office SharePoint Server with the new user information for the specified user, ensures that the old user’s security identifier (SID) is part of the SID history of the new user before doing the migration, and optionally enforces the SID history.

Namespace:  Microsoft.SharePoint.Portal
Assembly:  Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)

Syntax

'Declaration
Public Shared Function MigrateAccount ( _
    strOldAccountName As String, _
    strNewAccountName As String, _
    bEnforceSidHistory As Boolean _
) As Boolean
'Usage
Dim strOldAccountName As String
Dim strNewAccountName As String
Dim bEnforceSidHistory As Boolean
Dim returnValue As Boolean

returnValue = PortalAccountMigrationManager.MigrateAccount(strOldAccountName, _
    strNewAccountName, bEnforceSidHistory)
public static bool MigrateAccount(
    string strOldAccountName,
    string strNewAccountName,
    bool bEnforceSidHistory
)

Parameters

  • strOldAccountName
    Type: System.String
    The old, pre-migration Windows NT login (e.g., domain\username) of the migrated user.
  • strNewAccountName
    Type: System.String
    The new, post-migration Windows NT login (e.g., domain\username) for the migrated user.
  • bEnforceSidHistory
    Type: System.Boolean
    true to enforce the SID history; otherwise, false.

Return Value

Type: System.Boolean
Throws an exception if a fatal error is encountered; otherwise, returns true.

Remarks

After MigrateAccount finishes successfully, the following Office SharePoint Server settings are updated for all portals in the farm:

  • User profile information

  • Area contact information

  • Person listing information

  • Audience rule information

MigrateAccount updates all portals in a server farm. It should be run only once per server farm. MigrateAccount must be called in the context of a user with Central Administrator privileges on the farm that is being updated.

In an intra-farm shared services scenario, the master portal and all child portals in the farm are updated.

In an inter-farm shared services scenario, MigrateAccount should be run once on the child farm and once on the master farm.

MigrateAccount updates Office SharePoint Server settings only. Windows SharePoint Services settings should be updated first by way of its MigrateUserAccount method. It is recommended that you run the Windows SharePoint Services migration API before running this Office SharePoint Server API.

If an error is encountered, an exception will be thrown. The exception should contain an error message with information on why it was thrown.

To get more detailed information on the migration, see the portal diagnostic log. The log is named after the executable file that called MigrateAccount, and the timestamp of the log’s creation is appended. To view more information, set the logging level for third-party applications to Information.

Examples

The following code example shows how to use the MigrateUserAccount method to migrate one user account to another one.

MigrateAccount updates Office SharePoint Server settings only. Windows SharePoint Services settings should be updated first by way of its MigrateUserAccount method. It is recommended that you run the Windows SharePoint Services migration API before running this Office SharePoint Server API.

Dim AccManager As New PortalAccountMigrationManager()
AccManager.MigrateUserAccount("DOMAIN1\\User1", "DOMAIN2\\User2")
PortalAccountMigrationManager AccManager = new PortalAccountMigrationManager();
AccManager.MigrateUserAccount("DOMAIN1\\User1", "DOMAIN2\\User2");

See Also

Reference

PortalAccountMigrationManager Class

PortalAccountMigrationManager Members

MigrateAccount Overload

Microsoft.SharePoint.Portal Namespace