Tab Manager (.NET)

The Tab Manager API supports programmatically managing tabs in the Relativity. It includes the following features:

  • Supports create, read, update, and delete operations on tabs.
  • Provides helper methods that simplify working with tabs. You can use these methods to retrieve information about the display order of tabs, parent tabs, available object types to associated with tabs, and objects dependent on a specific tab. Additionally, you can also retrieve workspace-level metadata for admin and system tabs.

As a sample use case, you might use the Tab Manager service to add specialized tab functionality to custom pages in a Relativity application developed for your organization.

You can also use the Tab Manager service through the REST API. For more information, see Tab Manager (REST).

This page contains the following information:

Fundamentals for managing tabs

Review the following information to learn about the methods, classes, and other entities used by the Tab Manager service. For reference information, see Services API.

Methods

In the Relativity Services API, the Relativity.Services.Interfaces.Tab namespace contains the ITabManager interface that exposes the following methods:

  • GetAllNavigationTabs() method - retrieves a list of all tabs in a specified workspace that the calling user can navigate to. It returns a list of NavigationTabResponse objects. See Retrieve all tabs for navigation.
  • CreateAsync() method - adds a new tab to Relativity. This method takes the Artifact ID of a workspace and a TabRequest object as arguments. It returns the Artifact ID of the new Tab. See Create a tab.
  • DeleteAsync() method - removes a tab from Relativity. This method takes the Artifact ID of a workspace and a tab as arguments. See Delete a tab.
  • GetAvailableObjectTypesAsync() method - retrieves a list of object types for association with a tab when you are creating or updating it. This overloaded method returns a list of all available object types when you pass only the Artifact ID of a workspace to it. It returns a list of object types compatible with a tab when you pass the Artifact IDs of a workspace and an existing tab to it. See Retrieve object types for a tab.
  • GetAvailableParentsAsync() method - retrieves a list of all available parent tabs in a workspace, which you can associate with a new tab. See Retrieve available parent tabs.
  • GetDependencyList() method - retrieves a list of all objects dependent on an existing tab in a specified workspace. It returns a list of Dependency objects. See Retrieve dependent objects.
  • GetMetaAsync() method - retrieves workspace-level metadata about admin and system tabs. This method takes a workspace ID of -1 to indicate the admin-level context for system and admin tabs.
  • GetViewOrderList() method - retrieves a list of all tabs and the order assigned to them in a specific workspace. The order determines the position of a tab in the Relativity UI. This method returns a list of TabViewOrder objects. See Retrieve tab orders.
  • ReadAsync() method - retrieves metadata for a tab, including its name, order, link type, and other properties. You can also use this overloaded method to return extended metadata, including information about the operations that you have permissions to perform on the tab, such as update or delete. This method returns a TabResponse object. See Retrieve tab metadata.
  • UpdateAsync()method - modifies the properties of a tab, such as its name, order, and others. You can also use this overloaded method to restrict the update of a tab based on the date that it was last modified. See Update a tab.

Classes and enumerations

The Tab Manager API uses the following classes and enumerations available in the Relativity.Services.Interfaces.Tab.Models namespace:

  • TabRequest class - represents the data used to create or update a tab, including its name, order, visibility, and other properties. The CreateAsync() and UpdateAsync() methods return an object of this type.
  • TabResponse class - represents information about a tab, including its name, order, visibility, and other properties. The ReadAsync() method returns an object of this type.
  • TabViewOrder class - contains information about the location of the tab in the Relativity UI. It properties include the tab name, parent tab, order, and others. The Order property is a numerical value indicating the position of the tab relative to other tabs in the UI. The GetViewOrderList() method returns an object of this type. See Retrieve tab orders.
  • TabLinkTypeEnum enumeration - indicates type of link associated with the tab. For example, a parent type indicates that the tab can have child tabs, an external type indicates the tab links to a URL, and an object type indicates the tab links to a Relativity object.
  • NavigationTabResponse class - represents navigation information about a tab, including its URL as well as its name, order, visibility, parent and other properties. The GetAllNavigationTabs() method returns a list of objects of this type.

Guidelines for using the Tab Manager service

Review the following guidelines for working with the Tab Manager service.

Access the Tab Manager service

You can access the Tab Manager service by creating a client proxy through the Relativity Services API, and then instantiating a TabManager object. See the following sample code:

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")));
Services.Interfaces.Tab.ITabManager proxy = serviceFactory.CreateProxy<Services.Interfaces.Tab.ITabManager>();

Admin-level context

The methods on the Tab Manager API require that you pass an integer representing a workspace ID. You must pass -1 when you want to indicate the admin-level context. For example, you would pass -1 as the workspace ID to retrieve metadata for system or admin tabs. See Retrieve workspace-level metadata for admin and system tabs.

Retrieve a value from a Task object

When you call a method on the Tab Manager API, it returns a Task object. You can retrieve the data returned in Task object by retrieving the awaiter for the Task object, and then calling the GetResult() method. See the following sample code:

List<TabViewOrder> tabViewOrder = tabManager.GetViewOrderList(WorkspaceID).GetAwaiter().GetResult();

List<NameIDPair> allParentTabs = tabManager.GetAvailableParentsAsync(WorkspaceID).GetAwaiter().GetResult();

TabResponse entitiesTabResponse = tabManager.ReadAsync(WorkspaceID, entitiesTabArtifactID).GetAwaiter().GetResult();

Set ParentID property

When creating a tab, you must the set the Parent property. This property is required for tabs at all levels, including tabs created at the admin-level or as parent tabs. For admin-level tabs, set this property to SystemArtifactId, as illustrated in the following code sample:

int systemArtifactID = artifactHelper.RetrieveSystemArtifactId();
  
return new TabRequest()
{
    Name = Constants.ENTITIES_PARENT_TAB_NAME,
    Order = newEntitiesParentTabOrder,
    LinkType = TabLinkTypeEnum.Parent,
    IsVisible = true,
    Parent = new ObjectIdentifier { ArtifactID = systemArtifactID }
};

Use of response data from read operations

You may want to update a tab by using data obtained from a read operation. In the Tab Manager API, the ReadAsync() method returns a TabResponse object. However, the UpdateAsync() method requires that you pass a TabRequest object to it. To use data obtained from a read operation, you need to translate it from the form provided in the TabResponse object to that required for a TabRequest object, as illustrated in the following code sample:

TabResponse entitiesTabResponse = tabManager.ReadAsync(WorkspaceID, entitiesTabArtifactID).GetAwaiter().GetResult();
  
TabRequest entitiesTabRequest = TranslateTabResponseToTabRequest(entitiesTabResponse);
  
private TabRequest TranslateTabResponseToTabRequest(TabResponse tabResponse)
{
    TabRequest tabRequest = null;
  
    if (tabResponse != null)
    {
        tabRequest = new TabRequest
        {
            Name = tabResponse.Name,
            Order = tabResponse.Order,
            Link = tabResponse.Link,
            IsDefault = tabResponse.IsDefault,
            IsVisible = tabResponse.IsVisible,
            RelativityApplications = tabResponse.RelativityApplications.ViewableItems.Select(x => new ObjectIdentifier { ArtifactID = x.ArtifactID }).ToList(),
            LinkType = tabResponse.LinkType,
            Parent = new ObjectIdentifier { ArtifactID = tabResponse.Parent.Value.ArtifactID },
            ArtifactID = tabResponse.ArtifactID,
        };
  
        if ((tabResponse.ObjectType?.ArtifactID ?? -1) > 0)
        {
            tabRequest.ObjectType = new ObjectTypeIdentifier { ArtifactID = tabResponse.ObjectType.ArtifactID };
        }
    }
  
    return tabRequest;
}

Create a tab

To create a tab, call the CreateAsync() method by passing the Artifact ID of the workspace and a TabRequest object to it, as illustrated in the following code sample:

public bool CreateAsync(IHelper helper)
{
    bool success = false;
  
    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            string tabName = "Sample_Tab";
            TabRequest request = new TabRequest
            {
                Name = tabName,
                Order = 100,
                LinkType = TabLinkTypeEnum.Object,
                IsVisible = true,
                Parent = new ObjectIdentifier { ArtifactID = 1003663 }
  
            };
  
            int artifactId = proxy.CreateAsync(SampleWorkspace_ID, request).GetAwaiter().GetResult();
            if (artifactId != 0)
            {
                success = true;
            }
            else
            {
                _logger.LogError("Create failed");
            }
        }
        catch (Exception ex)
        {
            _logger.LogError("Create failed - {message}", ex.Message);
            throw;
        }
    }
  
    return success;

Retrieve tab metadata

The Tab Manager API includes the overloaded ReadAsync() method that you can use to retrieve basic or extended metadata for a tab. Extended metadata includes operations that you have permissions to perform on the tab, such as delete or update.

For basic tab metadata, call the ReadAsync() method by passing the Artifact IDs of the workspace and the tab. For extended metadata, you can pass Boolean values for both the includeMetadata and includeActions parameters on the overloaded method.

The following code sample illustrates how to retrieve basic metadata for a tab:

public bool ReadAsync(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            TabResponse response = proxy.ReadAsync(SampleWorkspace_ID, SampleTab_ID).GetAwaiter().GetResult();
            _logger.LogDebug("{TabID} - {TabName}", response.ArtifactID, response.Name);
            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Read failed - {message}", ex.Message);
            throw;
        }

    }

    return success;
}

Update a tab

To modify the properties of a tab, call the UpdateAsync() method by passing Artifact ID of the workspace and a TabRequest object to it. This overloaded method also supports restricting the update of a tab to the date that it was last modified. To restrict the update, you must pass a DateTime object to the method as well.

Note: The value for the DateTime object must match the LastModifiedOn date for the tab stored in Relativity. Otherwise, you receive an error, indicating that the object has been modified.

The following code sample illustrates how to update a tab:

public bool UpdateAsync(IHelper helper)
{
    bool success = false;
  
    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            string tabName = "Sample_Tab";
            TabRequest request = new TabRequest
            {
                Name = tabName,
                Order = 100,
                LinkType = TabLinkTypeEnum.Object,
                IsVisible = true,
                Parent = new ObjectIdentifier { ArtifactID = 1003663 },
                ObjectType = new ObjectTypeIdentifier { ArtifactTypeID = 10 }
            };
  
            proxy.UpdateAsync(SampleWorkspace_ID, request).GetAwaiter().GetResult();
            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Update failed - {message}", ex.Message);
            throw;
        }
  
    }
  
    return success;
}

Delete a tab

The Tab Manager API includes the DeleteAsync() method for removing a tab from Relativity. You must have the permissions to perform a delete operation. For more information, see Security and permissions in the Relativity RelativityOne Documentation site.

Before you delete a tab, consider checking for other dependent tabs. See Retrieve dependent objects.

The following code sample illustrates how to remove a tab by passing the Artifact IDs of the workspace and the existing tab to the DeleteAsync() method:

public bool DeleteAsync(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            proxy.DeleteAsync(SampleWorkspace_ID, SampleTab_ID).GetAwaiter().GetResult();
            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Delete failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve object types for a tab

When creating or editing a tab, you must associate it with an object. In the Tab Manager API, you can use the overloaded GetAvailableObjectTypesAsync() method to obtain a list of available object types before executing these operations:

  • Creating a tab - Retrieve a list of all object types in a workspace available for creating a tab. Pass the Artifact ID of a workspace to the GetAvailableObjectTypesAsync() method, as illustrated in the following code sample.
  • Updating a tab - Retrieve a list of all object types compatible with a specific tab. Pass the Artifact IDs of the workspace and the existing tab to the GetAvailableObjectTypesAsync() method.
public bool GetAvailableObjectTypesAsync(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            List<NameIDPair> response = proxy.GetAvailableObjectTypesAsync(SampleWorkspace_ID).GetAwaiter().GetResult();
            _logger.LogDebug("All availble object types for workspace {WorkspaceID}", SampleWorkspace_ID);

            foreach (NameIDPair nameID in response)
            {
                _logger.LogDebug("{Name} - {ArtifactID}", nameID.Name, nameID.ID);
            }

            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Get all available object types failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve available parent tabs

In the Relativity UI, a parent tab displays a drop-down list containing child tabs. The Tab Manager service includes the GetAvailableParentsAsync() method that retrieves a list of parent tabs, which you can associate with a tab when you add or edit it. Pass this method the Artifact ID of the workspace where you want to add the tab or where it currently exists, as illustrated in the following code sample:

public bool GetAvailableParentsAsync(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            List<NameIDPair> response = proxy.GetAvailableParentsAsync(SampleWorkspace_ID).GetAwaiter().GetResult();
            _logger.LogDebug("All availble parent tabs for workspace {WorkspaceID}", SampleWorkspace_ID);

            foreach (NameIDPair nameID in response)
            {
                _logger.LogDebug("{Name} - {ArtifactID}", nameID.Name, nameID.ID);
            }

            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Get all available parents failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve dependent objects

Before deleting a tab, you may want a list of other objects that are dependent on it, such as the children of a parent tab. For more information, see Deleting object dependencies on the Relativity RelativityOne Documentation site.

The Tab Manager API includes the GetDependencyList() method for obtaining this information by passing the Artifact IDs of a workspace and an existing tab to it, as illustrated in the following code sample:

public bool GetDependencyList(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            List<Dependency> response = proxy.GetDependencyList(SampleWorkspace_ID, SampleTab_ID).GetAwaiter().GetResult();
            _logger.LogDebug("List of all dependencies for an existing tab {TabID}", SampleWorkspace_ID);

            foreach (Dependency dependency in response)
            {
                _logger.LogDebug("{ObjectType} - {Count} - {Connection}", dependency.ObjectType, dependency.Count, dependency.Connection);
            }

            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Get dependency list failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve workspace-level metadata for admin and system tabs

You can retrieve workspace-level metadata about admin and system tabs. This metadata includes fields that can't be updated and those that aren't supported for a specific tab. In general, the following guidelines apply to this metadata:

  • Admin tabs - Because these tabs are supported only for workspaces, the RelativityApplications field is always returned as an unsupported field by the GetMetaAsync() method.
  • System tabs - Because these tabs are part of the core Relativity application, most of their fields can't be updated, and are returned by GetMetaAsync() method as read-only fields, such the Name, Link, and RelativityApplications fields. For example, the fields on the Errors tab are read-only.

The following code sample illustrates how to call the GetMetaAsync() method by passing the SampleWorkspace_ID, which would be -1 to indicate the admin-level context. See Admin-level context.

public bool GetMetaAsync(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            Meta response = proxy.GetMetaAsync(SampleWorkspace_ID).GetAwaiter().GetResult();
            _logger.LogDebug("Tab Meta for workspace {WorkspaceID}", SampleWorkspace_ID);

            foreach (String unsupportedMeta in response.Unsupported)
            {
                _logger.LogDebug("Unsupported - {UnsupportedMeta}", unsupportedMeta);
            }

            foreach (String readOnlyMeta in response.ReadOnly)
            {
                _logger.LogDebug("ReadOnly - {ReadOnlyMeta}", readOnlyMeta);
            }

            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Get workspace level metadata failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve tab orders

The order assigned to a tab determines its position in the Relativity UI. Tabs with a lower order number are displayed on the left, while those with higher order numbers are displayed on the right. For more information, see Tabs on the Relativity RelativityOne Documentation site.

The Tab Manager service includes the GetViewOrderList() method that you can use to retrieve the current order for tabs in a specific workspace. The following code sample illustrates how retrieve the tab order by calling the GetViewOrderList() method with the Artifact ID of a workspace. For the order of system or admin tabs, pass -1 instead of an Artifact ID. See Admin-level context.

public bool GetViewOrderList(IHelper helper)
{
    bool success = false;

    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            List<TabViewOrder> response = proxy.GetViewOrderList(SampleWorkspace_ID).GetAwaiter().GetResult();
            _logger.LogDebug("List of all tabs and their view order for workspace {WorkspaceID}", SampleWorkspace_ID);

            foreach (TabViewOrder viewOrder in response)
            {
                _logger.LogDebug("{Name} - {ArtifactID} - {Order}", viewOrder.Name, viewOrder.ArtifactID, viewOrder.Order);
            }

            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("Get view order list failed - {message}", ex.Message);
            throw;
        }
    }

    return success;
}

Retrieve all tabs for navigation

The tab manager API includes an endpoint that retrieves basic information about each tab the calling user can navigate to in a specific workspace. This endpoint returns a URL for navigating to each tab as well as tab metadata like the tab's name, order, visibility, parent, and other properties. To retrieve this data, call the GetAllNavigationTabs() method by passing the Artifact ID of the workspace. The following code illustrates how to retrieve navigation data for each tab in a workspace:

public bool GetAllNavigationTabs(IHelper helper)
{
    bool success = false;
   
    using (ITabManager proxy = helper.GetServicesManager().CreateProxy<ITabManager>(ExecutionIdentity.System))
    {
        try
        {
            List<NavigationTabResponse> response = proxy.GetAllNavigationTabs(SampleWorkspace_ID).GetAwaiter().GetResult();
                  
            foreach (NavigationTabResponse navigationTabResponse in response)
            {
                _logger.LogDebug("{Name} - {Order} - {URL}", navigationTabResponse.Name, navigationTabResponse.Order, navigationTabResponse.Url);
            }
  
  
            success = true;
        }
        catch (Exception ex)
        {
            _logger.LogError("GetAllNavigationTabs failed - {message}", ex.Message);
            throw;
        }
    }
   
    return success;
}

Community Updates

Aero Developer FAQ Evolving the Platform Most recent release notes
Learn more Learn more Learn more

Additional Resources

   
Access Third-Party Tools with GitHub     Create .NET Apps Faster with NuGet
Visit github     visit nuget