Workspace Manager (.NET)

In Relativity, a workspace acts as a secure data repository for documents. It supports customized views, layouts, fields, choices, and security settings. For more information, see Workspaces on the RelativityOne Documentation site.

The Workspace Manager API supports the following functionality:

  • CRUD operations on workspaces.
  • Helper methods for retrieving lists of available resources, such as matters, clients, and others.
  • Helper methods for retrieving information about advanced settings, such as workspace statuses, full text languages for the SQL Server, and others.
  • Helper methods for retrieving Azure credentials.

As a sample use case, you can simplify setting up reviews by using the Workspace Manager API to programmatically create multiple workspaces rather than manually adding them through the Relativity UI.

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

Fundamentals for the Workspace Manager API

The Workspace Manager API contains the following methods and classes as described in this section.

Methods

The Workspace Manager API exposes the following methods on the IWorkspaceManager interface in the Relativity.Environment.<VersionNumber>.Workspace namespace.

Note: The <VersionNumber> variable in the namespace indicates the version number of the API. The version number uses the format uppercase V and an integer version number, such as V1 or V2 in .NET.

Classes

The Workspace Manager API exposes the following classes available in the Relativity.Environment.<VersionNumber>.Workspace.Models namespace:

  • WorkspaceRequest class - represents a request for creating or updating a workspace.
  • WorkspaceResponse class - represents the results of a read operation on a workspace.
  • SqlFullTextLanguageOptions class - represents the available full text language options for the SQL Server associated with a workspace.
  • WorkspaceSummary class - represents the statistics for a workspace.

Guidelines for the Workspace Manager API

Review the following guidelines for working with the Workspace Manager API.

NuGet package

The NuGet package called Relativity.Environment.SDK is required to use the endpoints exposed in the Workspace Manager API. For more information, see SDK and Nuget Compatibility.

Create a proxy

You must use a proxy to interact with the Workspace Manager API. To set up a proxy, call the CreateProxy() method on the object returned by the GetServiceManager() method.

Copy
var userEmail = "user@test.com"; // User login
var password = "abc123456!"; // User password
 
Uri relativityServicesUri = new Uri("http://localhost/relativity.services");
Uri relativityRestUri = new Uri("http://localhost/relativity.rest/api");
 
var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
ServiceFactorySettings settings = new ServiceFactorySettings(
    relativityServicesUri,
    relativityRestUri,
    usernamePasswordCredentials);
ServiceFactory serviceFactory = new ServiceFactory(settings);
 
IWorkspaceManager workspaceManager = serviceFactory.CreateProxy<IWorkspaceManager>();

Field permissions

Review the following information about how field permissions are used by Workspace Manager API:

  • Secured fields - A user interacting with the Workspace Manager API may be given access to read and write to only select fields in the workspace. You can control this access by using the Securable<T> object types. Objects of this type have the following properties: Secured (bool) and Value (T). When the Secured property is set to true, the user doesn't have read or write access to the contents of the fields set for the Value property.

  • Read-only fields - A user may have permission to view a field but not update or delete it. In this case, the field name is included in the read-only list in the metadata. The following fields are examples: client, matter, and workspace admin group.

Cancellation and progress

The Workspace Manager API provides overloaded methods for create, update, and query operations, which support cancellation and progress functionality. For more information, see Cancellation and progress.

Create a workspace

Use the CreateAsync() method to add a new workspace to Relativity. This method takes a WorkspaceRequest object and returns a WorkspaceResponse object. All WorkspaceRequest properties related to the infrastructure details (DownloadHandlerUrl, Resource Pool, DefaultFileRepository, DataGridFileRepository, DefaultCacheLocation, SqlServer) are optional. If the infrastructure details are not explicitly specified in the request, they are automatically selected by the algorithm.

Copy
View code sample with all infrastructure details fields specified
public async Task CreateWorkspaceAsync(
     string name,
     int matterID,
     int templateID,
     int statusID,
     int resourcePoolID,
     int sqlServerID,
     int defaultFileRepositoryID,
     int dataGridFileRepositoryID,
     int defaultCacheLocationId)
{
    try
    {
        string downloadHandlerUrl = await _workspaceManager.GetDefaultDownloadHandlerURLAsync();
        WorkspaceRequest request = new WorkspaceRequest()
        {
            Name = name,
            Matter = new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = matterID}),
            Template = new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = templateID}),
            Status = new ObjectIdentifier() {ArtifactID = statusID},
            ResourcePool =
                new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = resourcePoolID}),
            SqlServer = new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = sqlServerID}),
            DefaultFileRepository = new Securable<ObjectIdentifier>(new ObjectIdentifier()
                {ArtifactID = defaultFileRepositoryID}),
            DataGridFileRepository = new Securable<ObjectIdentifier>(new ObjectIdentifier()
                {ArtifactID = dataGridFileRepositoryID}),
            DefaultCacheLocation = new Securable<ObjectIdentifier>(new ObjectIdentifier()
                {ArtifactID = defaultCacheLocationId}),
            DownloadHandlerUrl = downloadHandlerUrl
        };
   
        WorkspaceResponse response = await _workspaceManager.CreateAsync(request);
        Console.WriteLine($"Created workspace with artifact ID {response.ArtifactID} on {response.CreatedOn}");
    }
    catch (InvalidInputException ex)
    {
        Console.WriteLine("The following validation errors were found:");
        foreach (ValidationError error in ex.Errors)
        {
            Console.WriteLine($"\t{error.PropertyName}: {error.ErrorMessage}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to create workspace: {ex.Message}");
        throw;
    }
}
Copy
View a code sample with no infrastructure details fields specified
public async Task CreateWorkspaceAsync(string name, int matterID, int templateID, int statusID)
{
    try
    {
        WorkspaceRequest request = new WorkspaceRequest()
        {
            Name = name,
            Matter = new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = matterID}),
            Template = new Securable<ObjectIdentifier>(new ObjectIdentifier() {ArtifactID = templateID}),
            Status = new ObjectIdentifier() {ArtifactID = statusID}
        };
   
        WorkspaceResponse response = await _workspaceManager.CreateAsync(request);
        Console.WriteLine($"Created workspace with artifact ID {response.ArtifactID} on {response.CreatedOn}");
    }
    catch (InvalidInputException ex)
    {
        Console.WriteLine("The following validation errors were found:");
        foreach (ValidationError error in ex.Errors)
        {
            Console.WriteLine($"\t{error.PropertyName}: {error.ErrorMessage}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to create workspace: {ex.Message}");
        throw;
    }
}

Create operation helper methods

The following helper methods provide functionality to support the create operation.

Retrieve unsupported fields for a create operation

Use the GetMetaAsync() method to retrieve a list of unsupported WorkspaceRequest fields for a create operation.

Copy
public async Task GetMetaAsync()
{
    try
    {
        Meta meta = await _workspaceManager.GetMetaAsync();
 
        if (meta.ReadOnly.Any())
        {
            Console.WriteLine($"The following fields are read-only: {string.Join(", ", meta.ReadOnly)}");
        }
        else
        {
            Console.WriteLine("No fields are read-only.");
        }
 
        if (meta.Unsupported.Any())
        {
            Console.WriteLine($"The following fields are unsupported: {string.Join(", ", meta.Unsupported)}");
        }
        else
        {
            Console.WriteLine("No fields are unsupported.");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to get meta: {ex.Message}");
        throw;
    }
}

Retry failed create event handlers

Use the RetryFailedCreateEventHandlersAsync() method to retry failed create event handlers for a workspace. This method takes the Artifact ID of the workspace as an argument.

Copy
public async Task RetryFailedCreateEventHandlersAsync(int workspaceID)
{
    try
    {
        await _workspaceManager.RetryFailedCreateEventHandlersAsync(workspaceID);
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to retry failed create event handlers: {ex.Message}");
        throw;
    }
}

Retrieve a workspace

Use the ReadAsync() method to retrieve a workspace. This method takes the Artifact ID of a workspace and returns a WorkspaceResponse object.

Copy
public async Task ReadWorkspaceAsync(int workspaceID, bool includeMetadata, bool includeActions)
{
    try
    {
        WorkspaceResponse response = await _workspaceManager.ReadAsync(workspaceID, includeMetadata, includeActions);
        Console.WriteLine($"Workspace {workspaceID} has the name {response.Name}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to read workspace {workspaceID}: {ex.Message}");
        throw;
    }
}

Update a workspace

Use the UpdateAsync() method to modify the properties of a workspace. This method takes the Artifact ID of the workspace and a WorkspaceRequest object. It returns a WorkspaceResponse object.

Copy
public async Task UpdateWorkspaceAsync(int workspaceID)
{
    try
    {
        WorkspaceResponse originalWorkspace = await _workspaceManager.ReadAsync(workspaceID, true, true);
         
        WorkspaceRequest request = new WorkspaceRequest()
        {
            Name = "Updated Workspace",
            Matter = new Securable<ObjectIdentifier>() { Value = originalWorkspace.Matter.Value },
            Status = originalWorkspace.Status,
            ResourcePool = new Securable<ObjectIdentifier>() { Value = originalWorkspace.ResourcePool.Value },
            SqlServer = new Securable<ObjectIdentifier>() { Value = originalWorkspace.SqlServer.Value },
            DefaultFileRepository = new Securable<ObjectIdentifier>() { Value = originalWorkspace.DefaultFileRepository.Value },
            DefaultCacheLocation = new Securable<ObjectIdentifier>() { Value = originalWorkspace.DefaultCacheLocation.Value },
            DownloadHandlerUrl = originalWorkspace.DownloadHandlerUrl
        };
 
        WorkspaceResponse response = await _workspaceManager.UpdateAsync(workspaceID, request);
        Console.WriteLine($"Updated workspace with artifact ID {workspaceID} on {response.LastModifiedOn}");
    }
    catch (InvalidInputException ex)
    {
        Console.WriteLine("The following validation errors were found:");
        foreach (ValidationError error in ex.Errors)
        {
            Console.WriteLine($"\t{error.PropertyName}: {error.ErrorMessage}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to update workspace: {ex.Message}");
        throw;
    }
}

Delete a workspace

Use the DeleteAsync() method to remove a workspace from Relativity. This method takes the Artifact ID of the workspace.

Copy
public async Task DeleteWorkspaceAsync(int workspaceId)
{
    try
    {
        await _workspaceManager.DeleteAsync(workspaceId);
    }
    catch (InvalidInputException ex)
    {
        Console.WriteLine("The following validation errors were found:");
        foreach (ValidationError error in ex.Errors)
        {
            Console.WriteLine($"\t{error.PropertyName}: {error.ErrorMessage}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to update workspace: {ex.Message}");
        throw;
    }
}

Retrieve workspace statistics

Use the GetWorkspaceSummaryAsync() method to retrieve a summary of workspace statistics. This method takes the Artifact ID of the workspace as an argument and returns a WorkspaceSummary object.

Copy
public async Task GetWorkspaceSummaryAsync(int workspaceID)
{
    try
    {
        WorkspaceSummary workspaceSummary = await _workspaceManager.GetWorkspaceSummaryAsync(workspaceID);
        Console.WriteLine($"Document Count: {workspaceSummary.DocumentCount}");
        Console.WriteLine($"File Size: {workspaceSummary.FileSize}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to get workspace summary: {ex.Message}");
        throw;
    }
}

Retrieve workspaces associated with a group

Use the QueryWorkspaceByGroupAsync() method to retrieve workspaces associated with a group. This method takes a QueryRequest object, a start index, the number of groups to include in the results, and the Artifact ID of a group. It returns a QueryResultSlim object. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryWorkspaceByGroupAsync(int groupID)
{
    try
    {
        QueryRequest workspacesRequest = new QueryRequest();
        QueryResultSlim workspacesResponse = await _workspaceManager.QueryWorkspaceByGroupAsync(workspacesRequest, 1, _QUERY_LENGTH, groupID);
 
        foreach (int workspaceID in workspacesResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine($"Workspace {workspaceID} is part of group {groupID}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query workspaces: {ex.Message}");
        throw;
    }
}

Resource information helper methods

The following helper methods correspond to the fields that you can set in the Resource Information section of the Workspace form in the Relativity UI. For more information, see Workspaces on the RelativityOne Documentation site.

Retrieve matters

Use the QueryEligibleMattersAsync() method to retrieve a list of matters. This method takes a QueryRequest object, a start index, and the number of matters to include in the results. It returns a QueryResultSlim object with a list of available matters. Use this method when setting the Matter property on a workspace. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryEligibleMattersAsync()
{
    try
    {
        QueryRequest mattersRequest = new QueryRequest();
        QueryResultSlim mattersResponse = await _workspaceManager.QueryEligibleMattersAsync(mattersRequest, 1, _QUERY_LENGTH);
 
        Console.WriteLine("Eligible Matters:");
        foreach (int matterID in mattersResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine(matterID);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible matters: {ex.Message}");
        throw;
    }
}

Retrieve clients

Use the QueryEligibleClientsAsync() method to retrieve a list of clients available for this workspace. This method takes a QueryRequest object, a start index, and the number of clients to include in the results. It returns a QueryResultSlim object with a list of available clients. Use this method when setting the Client property on a workspace. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryEligibleClientsAsync()
{
    try
    {
        QueryRequest clientsRequest = new QueryRequest();
        QueryResultSlim clientsResponse = await _workspaceManager.QueryEligibleClientsAsync(clientsRequest, 1, _QUERY_LENGTH);
 
        Console.WriteLine("Eligible Clients:");
        foreach (int clientID in clientsResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine(clientID);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible clients: {ex.Message}");
        throw;
    }
}

Retrieve workspaces for use as templates

Use the QueryEligibleTemplatesAsync() method to retrieve a list of workspaces for use as templates when creating a new workspace. This method takes a QueryRequest object, a start index, and the number of templates to include in the results. It returns a QueryResultSlim object with a list of available templates. Use this method when setting the Template property on a workspace. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryEligibleTemplatesAsync()
{
    try
    {
        QueryRequest templatesRequest = new QueryRequest();
        QueryResultSlim templatesResponse = await _workspaceManager.QueryEligibleTemplatesAsync(templatesRequest, 1, _QUERY_LENGTH);
 
        Console.WriteLine("Eligible Templates:");
        foreach (int templateID in templatesResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine(templateID);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible templates: {ex.Message}");
        throw;
    }
}

Retrieve resource pools

Use the GetEligibleResourcePoolsAsync() method to retrieve a list of resource pools. This method returns a list of DisplayableObjectIdentifier objects, which identify available resource pools. Use this method when setting the ResourcePool property for a workspace.

Copy
public async Task GetEligibleResourcePoolsAsync()
{
    try
    {
        List<DisplayableObjectIdentifier> resourcePools = await _workspaceManager.GetEligibleResourcePoolsAsync();
        Console.WriteLine("Eligible Resource Pools:");
        foreach (DisplayableObjectIdentifier resourcePool in resourcePools)
        {
            Console.WriteLine($"\t{resourcePool.Name} ({resourcePool.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible resource pools: {ex.Message}");
        throw;
    }
}

Retrieve SQL Servers

Use the GetEligibleSqlServersAsync() method to retrieve a list of SQL servers available for the workspace. This method takes the Artifact ID of a resource pool and returns a list of DisplayableObjectIdentifier objects, which identify available SQL servers. Use this method when setting the SqlServer property for a workspace.

Copy
public async Task GetEligibleSqlServersAsync(int resourcePoolID)
{
    try
    {
        List<DisplayableObjectIdentifier> sqlServers = await _workspaceManager.GetEligibleSqlServersAsync(resourcePoolID);
        Console.WriteLine("Eligible SQL Servers:");
        foreach (DisplayableObjectIdentifier sqlServer in sqlServers)
        {
            Console.WriteLine($"\t{sqlServer.Name} ({sqlServer.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible SQL servers: {ex.Message}");
        throw;
    }
}

Retrieve file repository servers

Use the GetEligibleFileRepositoriesAsync() method to retrieve a list of available file repository servers. This method takes the Artifact ID of a resource pool and returns a list of DisplayableObjectIdentifier objects, which identify available servers. Use this method when setting the DefaultFileRepository and DataGridRepository properties for a workspace.

Copy
public async Task GetEligibleFileRepositoriesAsync(int resourcePoolID)
{
    try
    {
        List<DisplayableObjectIdentifier> fileRepositories = await _workspaceManager.GetEligibleFileRepositoriesAsync(resourcePoolID);
        Console.WriteLine("Eligible File Repositories:");
        foreach (DisplayableObjectIdentifier fileRepository in fileRepositories)
        {
            Console.WriteLine($"\t{fileRepository.Name} ({fileRepository.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible file repositories: {ex.Message}");
        throw;
    }
}

Retrieve cache location servers

Use the GetEligibleCacheLocationsAsync() method to retrieve a list of available cache location servers. This method takes the Artifact ID of a resource pool and returns a list of DisplayableObjectIdentifier objects, which identify available cache locations. Use this method when setting the DefaultCacheLocation property for a workspace.

Copy
public async Task GetEligibleCacheLocationsAsync(int resourcePoolID)
{
    try
    {
        List<DisplayableObjectIdentifier> cacheLocations = await _workspaceManager.GetEligibleCacheLocationsAsync(resourcePoolID);
        Console.WriteLine("Eligible Cache Locations:");
        foreach (DisplayableObjectIdentifier cacheLocation in cacheLocations)
        {
            Console.WriteLine($"\t{cacheLocation.Name} ({cacheLocation.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible cache locations: {ex.Message}");
        throw;
    }
}

Retrieve the URL for the default download handler

Use the GetDefaultDownloadHandlerURLAsync() method to retrieve the URL for the default download handler. This method returns a URL.

This endpoint doesn't require any specific permissions.

Copy
public async Task GetDefaultDownloadHandlerURLAsync()
{
    try
    {
        string downloadHandlerUrl = await _workspaceManager.GetDefaultDownloadHandlerURLAsync();
        Console.WriteLine($"The default download handler URL is {downloadHandlerUrl}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to get download handler URL: {ex.Message}");
        throw;
    }
}

Advanced settings helper methods

The following helper methods correspond to the fields that you can set in the Advanced settings section of the Workspace form in the Relativity UI. For more information, see Workspaces on the RelativityOne Documentation site.

Retrieve available statuses for a workspace

Use the GetEligibleStatusesAsync() method to retrieve a list of available statuses for a workspace. This method returns a list of DisplayableObjectIdentifier objects, which contain the Artifact ID, Name, and GUIDs identifying each status. Use this method when setting the Status property on a workspace.

Copy
public async Task GetEligibleStatusesAsync()
{
    try
    {
        List<DisplayableObjectIdentifier> statuses = await _workspaceManager.GetEligibleStatusesAsync();
 
        Console.WriteLine("Eligible Statuses:");
        foreach (DisplayableObjectIdentifier status in statuses)
        {
            Console.WriteLine($"{status.Name} ({status.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to get eligible statuses: {ex.Message}");
        throw;
    }
}

Retrieve full text languages for SQL Server

Use the GetEligibleSqlFullTextLanguagesAsync() method to retrieve a list of available full text languages for the SQL Server assigned to a workspace. This method returns a list of SqlFullTextLanguageOptions objects, which describe the available and default languages. Use this method when setting the SqlFullTextLanguage property on a workspace.

Copy
public async Task GetEligibleSqlFullTextLanguagesAsync()
{
    try
    {
        SqlFullTextLanguageOptions sqlFullTextLanguageOptions = await _workspaceManager.GetEligibleSqlFullTextLanguagesAsync();
 
        Console.WriteLine("Eligible SQL Full Text Languages:");
        foreach (NameIDPair language in sqlFullTextLanguageOptions.Languages)
        {
            Console.WriteLine($"{language.Name} ({language.ID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to get eligible SQL full text languages: {ex.Message}");
        throw;
    }
}

Retrieve groups for workspace membership

Use the QueryEligibleGroupsAsync() method to retrieve a list of groups available for workspace membership. This method takes a QueryRequest object, a start index, and the number of groups to include in the results. It returns a QueryResultSlim object with a list of available groups. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryEligibleGroupsAsync()
{
    try
    {
        QueryRequest groupsRequest = new QueryRequest();
        QueryResultSlim groupsResponse = await _workspaceManager.QueryEligibleGroupsAsync(groupsRequest, 1, _QUERY_LENGTH);
 
        Console.WriteLine("Eligible Groups:");
        foreach (int groupID in groupsResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine(groupID);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible groups: {ex.Message}");
        throw;
    }
}

Retrieve saved searches for production restrictions

Use the QueryEligibleSavedSearchesAsync() method to retrieve saved searches for use with production restrictions. For more information, see Adding and editing production restrictions on the RelativityOne Documentation site.

This method takes a QueryRequest object, a start index, and the number of saved searches to include in the results. It returns a QueryResultSlim object with a list of available saved searches. Use this method when setting the ProductionRestrictions property on a workspace. For more information about QueryResultSlim objects, see Query for Relativity objects.

Copy
public async Task QueryEligibleSavedSearchesAsync(int workspaceID)
{
    try
    {
        QueryRequest savedSearchRequest = new QueryRequest();
        QueryResultSlim savedSearchResponse = await _workspaceManager.QueryEligibleSavedSearchesAsync(savedSearchRequest, 1, _QUERY_LENGTH, workspaceID);
 
        Console.WriteLine("Eligible Saved Searches:");
        foreach (int savedSearchID in savedSearchResponse.Objects.Select(x => x.ArtifactID))
        {
            Console.WriteLine(savedSearchID);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible saved searches: {ex.Message}");
        throw;
    }
}

Azure credentials helper methods

Use the following methods to retrieve Azure credentials associated with a resource pool. For more information, see Workspaces on the RelativityOne Documentation site.

Retrieve Azure credentials

Use the GetEligibleAzureCredentialsAsync() method to retrieve a list of available Azure credentials for the workspace. This method takes the Artifact ID of a resource pool and returns a list of DisplayableObjectIdentifier objects, which identify available credentials. Use this method when setting the AzureCredentials property on a workspace.

Copy
public async Task GetEligibleAzureCredentialsAsync(int resourcePoolID)
{
    try
    {
        List<DisplayableObjectIdentifier> azureCredentials = await _workspaceManager.GetEligibleAzureCredentialsAsync(resourcePoolID);
        Console.WriteLine("Eligible Azure Credentials:");
        foreach (DisplayableObjectIdentifier azureCredential in azureCredentials)
        {
            Console.WriteLine($"\t{azureCredential.Name} ({azureCredential.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible Azure credentials: {ex.Message}");
        throw;
    }
}

Retrieve Azure file system credentials

Use the GetEligibleAzureFileSystemCredentialsAsync() method to retrieve a list of available Azure file system credentials. This method takes the Artifact ID of a resource pool and returns a list of DisplayableObjectIdentifier objects, which identify available credentials. Use this method when setting the AzureFileSystemCredentials property on a workspace.

Copy
public async Task GetEligibleAzureFileSystemCredentialsAsync(int resourcePoolID)
{
    try
    {
        List<DisplayableObjectIdentifier> azureFileSystemCredentials = await _workspaceManager.GetEligibleAzureFileSystemCredentialsAsync(resourcePoolID);
        Console.WriteLine("Eligible Azure File System Credentials:");
        foreach (DisplayableObjectIdentifier azureFileSystemCredential in azureFileSystemCredentials)
        {
            Console.WriteLine($"\t{azureFileSystemCredential.Name} ({azureFileSystemCredential.ArtifactID})");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to query eligible Azure file system credentials: {ex.Message}");
        throw;
    }
}