Password Bank Manager API

The Password Bank Manager service includes functionality for retrieving document passwords added to the password bank through the Relativity UI. It returns a list of document passwords associated with a specific workspace ID. Relativity uses these passwords when processing, imaging, or converting documents. For more information, see Password bank on the Relativity Documentation site.

You can use this service to retrieve the passwords required to access the contents of the documents encrypted with them. For example, you may want to develop a custom application that needs to access the content of password protected documents. You might also want to create a custom page that displays a list of document passwords for reference or other purposes.

In addition, you can use the Password Bank Manager service through the REST API. For more information, see Document passwords.

This page contains the following information:

Document password fundamentals

In the Services API, the Relativity.Services.PasswordBank namespace contains the IPasswordBankManager interface with a method for retrieving document passwords. The IPasswordBankManager interface provides access to the Password Bank Manager service so that you can use the GetAllPasswordsAsync() method. This method retrieves the document passwords added to a specific workspace. Use the following guidelines when working with the Password Bank Manager service:

  • The GetAllPasswordsAsync() method takes the Artifact ID for the workspace where you want to query for passwords as an argument. It returns the document passwords as a single list of non-delimited strings. If you pass an invalid workspace ID, the Password Bank Manager service throws a ValidationException.
  • The GetAllPasswordsAsync() method retrieves the fields for passwords of all password entry types. The password entry types include Lotus Notes, email encryption certificates, and general passwords.
  • The Password Bank Manager service automatically checks for required permissions before returning a list of passwords. It checks for the following permissions:
    • At the workspace-level, the calling user must have at least view permission to password entry objects. If the calling user doesn't have this permission, the service returns an empty list. For more information, see Permission Manager API or Setting workspace permissions on the Relativity Documentation site.
    • The calling user must also have permission to the individual password entry object. The service returns only the passwords contained in password entry objects that the user can access.

Retrieve document passwords

Use the GetAllPasswordsAsync() method to retrieve a list of document passwords in a workspace. You call this method by passing the Artifact ID of the workspace containing the passwords that you want to retrieve. This method returns a list of non-delimited strings.

The following code sample illustrates how to perform these tasks:

  • Use helper classes to create the proxy and select an appropriate authentication type. See Relativity API Helpers.
  • Create the Services API proxy within a using block in your code.
  • Call the GetAllPasswordsAsync() method within a try-catch block.
  • Use await/async design pattern. See Basic Services API concepts.
  • Use the logging framework for troubleshooting and debugging purposes. See Log from a Relativity application .
public async Task<List<string>> GetAllPasswordsAsync(Client.SamplesLibrary.Helper.IHelper helper, int workspaceArtifactId)
{
    List<string> passwords = null;

    using (IPasswordBankManager proxy = helper.GetServicesManager().CreateProxy<IPasswordBankManager>(ExecutionIdentity.User))
    {
        try
        {
            passwords = await proxy.GetAllPasswordsAsync(workspaceArtifactId);
        }
        catch (ServiceException exception)
        {
            ISampleLogger _logger = Client.SamplesLibrary.Logging.Log.Logger.ForContext<IPasswordBankManager>();
            _logger.LogError(exception,
                            "PasswordBank Service GetAllPasswordsAsync call failed for Workspace ID {0}", workspaceArtifactId);
        }
    }

    return passwords;
}