ALM Site Administration API Type Library
AlignRepository Method
Realigns an optimized repository that was created from a snapshot.
Visual Basic
Public Function AlignRepository( _
   ByVal DomainName As String, _
   ByVal ProjectName As String, _
   ByVal Mode As String _
) As String
The logical group of projects in the ALM database.
The name of the project in the ALM database.
One of silent or interactive. If an empty string is passed, the mode is interactive.
Return Type

A string indicating whether the process was successfully launched.

Since the process it asynchronous, successful launch does not indicate whether the process ran to completion. Use ReadMaintenanceTaskProgress to check the actual state of the process.


When a backup is made of a project that is online, changes to attachments may occur while the backup is in progress. Deletions, additions, or modifications performed during the backup may cause the copy of the project database to be inconsistent with the copy of the file system.

When such a backup is restored, there may be references in the project database to files that do not exist on the file system, and files on the file system that are not referenced in the project database. This method deletes the orphaned references and files.

Additions and modifications performed during the backup are not recoverable with this method.


using SACLIENTLib;

public void AlignRepositorySync( SAapi saConnection, 
                                 string saURL, string user, string password, 
                                 string domainName, string projectName )
    saConnection.Login( saUrl, user, password );

    // mode is empty string for interactive behavior
    saConnection.AlignRepository( domainName, projectName, string.Empty ); 

    // set timeout for aligner to 10 minutes
    for ( int i = 0; i < 10 * 60; i++ ){ 
        Thread.Sleep( 1000 );
        projectStatus = 
                         (domainName, projectName );

        if ( projectStatus == "Y" || projectStatus == "N" )

    if ( projectStatus != "Y" && projectStatus != "N" ){
            throw new Exception( "Timeout for Repository Aligner Reached" );

See Also