User Information Manager API

The User Information Manager service supports the retrieval of all users from a workspace or admin-level context. It provides the option to filter on a list of users with conditions set in a query. When you filter on the results, paging is also available. The service returns the Artifact ID, full name, and email address for each user. As a sample use case, you could use this service to retrieve user information for display in a view for a custom application.

In addition, you can use the User Information Manager service through the REST API. For more information, see User Information Manager service.

This page contains the following information:

See the following related page:

User Information Manager API fundamentals

The Relativity.Services.Interfaces.UserInfo namespace contains the interfaces used by the User Information Manager service. The IUserInfoManager interface exposes the following methods:

  • RetrieveAll() method - returns a list of UserInfo instances. See Retrieve all users.
  • RetrieveUsersBy() method - returns a list of UserInfo instances. This method also supports filtering on the list of users by specifying a conditions in query, and paging. See Retrieve and filter on users.

Relativity.Services.Interfaces.UserInfo.Models namespace contains the following classes used by this service:

  • UserInfo class - represents information about a user. Its properties include ArtifactID, Email, and FullName. The RetrieveAll() method returns a list containing objects of this type.
  • UserInfoQueryResultSet class - represents the results of a search for users. It has a DataResults property that contains an list of UserInfo objects that match the query used for filtering. Additional properties support paging functionality, such as CurrentStartIndex, ResultCount, and TotalResultCount. See Retrieve and filter on users.

Retrieve all users

You can retrieve a list of all users and their information in a workspace or at the admin-level context by passing the following arguments to the RetrieveAll() method:

  • Workspace level - Pass the Artifact ID for a workspace containing that users that you want to retrieve.
  • Admin-level - Pass -1 to retrieve users at the admin-level context.

The RetrieveAll() method returns a list of UserInfo instances, which contain the Artifact ID, full name, and email address for each user. See the following sample code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
public async Task<bool> RetrieveAll(IHelper helper)
{
    bool success = false;
 
    using (IUserInfoManager proxy = helper.GetServicesManager().CreateProxy<IUserInfoManager>(ExecutionIdentity.User))
    {
        Logging.ISampleLogger logger = _logger.ForContext("MethodName", nameof(RetrieveAll), false);
 
        try
        {
            var users = await proxy.RetrieveAll(this.SampleWorkspace_ID);
 
            if (users?.Count > 0)
            {
                logger.LogInformation("RetrieveAll succeeded. User(first in the list) ArtifactID is {ArtifactID}, FullName is {FullName}, Email is {Email}.", users[0].ArtifactID, users[0].FullName, users[0].Email);
            }
            else
            {
                logger.LogInformation("RetrieveAll succeeded with empty Users list.");
            }
 
            success = true;
        }
        catch (Exception ex)
        {
            logger.LogError(ex, "Unhandled Exception");
        }
    }
 
    return success;
}

Retrieve and filter on users

Like the RetrieveAll() method, the RetrieveUsersBy() method gets a list of all users and their information. It also supports filtering on the list of users with query conditions. You call this method by passing the following arguments:

  • The Artifact ID of the workspace containing the users that you want to retrieve. Pass -1 to retrieve users at the admin-level context.
  • A QueryRequest object that contains the conditions, sort order, and other information used for filtering. This class is available in the Relativity.Services.Objects.DataContracts namespace, and passed to methods in the Object Manager API. For additional information, see Object Manager API and Services API.
  • The index of the first artifact in the result set.
  • The number of items to return in the query result.

The RetrieveUsersBy() method returns a UserInfoQueryResultSet object that supports paging functionality, including the start index, result count per page, and total number of objects returned.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
public async Task<bool> RetrieveUsersBy(IHelper helper)
{
    bool success = false;
 
    using (IUserInfoManager proxy = helper.GetServicesManager().CreateProxy<IUserInfoManager>(ExecutionIdentity.User))
    {
        Logging.ISampleLogger logger = _logger.ForContext("MethodName", nameof(RetrieveUsersBy), false);
 
        try
        {
            var usersFilterQuery = new QueryRequest
            {
                Condition = @"('FullName' LIKE 'Admin') OR ('ArtifactID' == 1030727)"
                ,
                Sorts = new List<global::Relativity.Services.Objects.DataContracts.Sort>()
                {
                    new global::Relativity.Services.Objects.DataContracts.Sort()
                    {
                        FieldIdentifier = new FieldRef() {Name = "FullName"},
                        Direction = global::Relativity.Services.Objects.DataContracts.SortEnum.Ascending,
                        Order = 2
                    }
                    ,
                    new global::Relativity.Services.Objects.DataContracts.Sort()
                    {
                        FieldIdentifier = new FieldRef() {Name = "Email"},
                        Direction = global::Relativity.Services.Objects.DataContracts.SortEnum.Descending,
                        Order = 1
                    }
                }
            };
 
            var users = await proxy.RetrieveUsersBy(SampleWorkspace_ID, usersFilterQuery, 1, 100);
 
            if (users?.ResultCount > 0)
            {
                var usersListFirstElement = users.DataResults.ToArray()[0];
                logger.LogInformation("RetrieveUsersBy succeeded. Paging inf: Count per page {ResultCount}, current index {CurrentStartIndex}, Total count {TotalResultCount}.  " +
                                    "User(first in the list) ArtifactID is {ArtifactID}, FullName is {FullName}, Email is {Email}.",
                    users.ResultCount,
                    users.CurrentStartIndex,
                    users.TotalResultCount,
                    usersListFirstElement.ArtifactID,
                    usersListFirstElement.FullName,
                    usersListFirstElement.Email);
            }
            else
            {
                logger.LogInformation("RetrieveUsersBy succeeded with empty Users list.");
            }
 
            success = true;
        }
        catch (Exception ex)
        {
            logger.LogError(ex, "Unhandled Exception");
        }
    }
 
    return success;
}