Keyboard Shortcuts Manager API

The Keyboard Shortcuts Manager API supports retrieving all keyboard shortcuts available in a workspace, or a specific subset of them, such as those assigned to the system, choices, or fields. It also provides information about the actions that these shortcuts trigger.

As a sample use case, you might want to implement custom keyboard shortcuts in layout, such as the document viewer. You could use this service to retrieve the information required to attach the appropriate shortcut to a specific field or choice, or for global use at the system level. Users could then navigate with the custom keyboard shortcuts through fields and choices, or trigger global actions with them.

You can also use the Keyboard Shortcuts Manager service through the REST API. For more information, see Keyboard Shortcuts Manager service.

This page contains the following information:

Fundamentals for working with keyboard shortcuts

In the Services API, the Relativity.Services.KeyboardShortcuts namespace contains the IKeyboardShortcutsManager interface with an overloaded method for retrieving a list of keyboard shortcuts from a specified workspace:

  • GetKeyboardShortcuts(Int32) - This method takes the Artifact ID of a specific workspace, and returns a list of KeyboardShortcutInformation objects. It retrieves a list of all keyboard shortcuts in the workspace. See Retrieve keyboard shortcuts
  • GetKeyboardShortcuts (Int32, KeyboardShortcutsRequest) - This method takes the Artifact ID of a specific workspace, and an optional KeyboardShortcutsRequest object. This object contains optional properties that you can set to retrieve only keyboard shortcuts associated with the system, choices, or fields. This method returns a list of KeyboardShortcutInformation objects. See Retrieve keyboard shortcuts

In addition, the Relativity.Services.KeyboardShortcuts namespace contains the following classes that support this service:

  • KeyboardShortcutInformation - represents information about a keyboard shortcut, including the type of shortcut such as choice, field, or system, the action triggered by executing the shortcut, and other information. For keyboard shortcuts associated with choices and fields, the ArtifactID property contains the identifier for the choice or field. The GetKeyboardShortcuts() returns an object of this type.
  • KeyboardShortcutsRequest - represents a request to retrieve a list of keyboard shortcuts. Its properties are IncludeChoiceShortcuts, IncludeFieldShortcuts, and IncludeSystemShortcuts, which you can optionally use for filtering on choice, field, and system shortcuts respectively. The GetKeyboardShortcuts() optionally takes an object of this type.
  • KeyCombination - represents additional keys used as part of the shortcut. Its properties include Alt, Ctrl, and Shift, which are a Boolean values indicating whether a respective key is used in the shortcut. The Key property is a number that indicates alphanumeric and other keys used in combination with the Alt, Ctrl, or Shift keys. For a list of keys, see KeysCombination on Keyboard Shortcuts Manager service.

For more information about these classes, see Services API in the Relativity API reference page.

Retrieve keyboard shortcuts

To retrieve a list of all keyboard shortcuts in a workspace, call the GetKeyboardShortcuts() method and pass the Artifact ID of a workspace to it. This overloaded method supports filtering on choice, field, or system shortcuts by passing a KeyboardShortcutsRequest object. You can set the properties on this object to the type of shortcuts that you want to return.

The following code sample illustrates how to pass the Artifact ID of workspace to the GetKeyboardShortcuts() method.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public async Task GetKeyboardShortcuts()
{
   Uri servicesUri = new Uri("http://localhost/relativity.services");
   Uri keplerEndpoint = new Uri("http://localhost/relativity.rest/api");
 
   Services.ServiceProxy.ServiceFactory serviceFactory = new Services.ServiceProxy.ServiceFactory(
        new Services.ServiceProxy.ServiceFactorySettings(servicesUri, keplerEndpoint,
        new  Services.ServiceProxy.UsernamePasswordCredentials("username", "password")));
 
   Relativity.Services.KeyboardShortcuts.IKeyboardShortcutsManager proxy = serviceFactory.CreateProxy<Relativity.Services.KeyboardShortcuts.IKeyboardShortcutsManager>();
 
   var workspaceArtifactId = 0; //artifact ID of active workspace
 
   Relativity.Services.KeyboardShortcuts.Models.KeyboardShortcutInformation result = await proxy.GetKeyboardShortcuts (workspaceArtifactId);
}