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:

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

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:

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:

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 RetrieveUsersBy() method returns a UserInfoQueryResultSet object that supports paging functionality, including the start index, result count per page, and total number of objects returned.

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;
}

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