This DTO has been removed as part of the Relativity Services API (RSAPI) Deprecation and is no longer supported. For more information and alternative APIs, see RSAPI deprecation process.

View

Relativity uses views to provide customizable item lists. For more information, see Views on the RelativityOne Documentation site.

The Services API supports read and query operations on a View DTO. You can also read views using the common DTO ReadSingle method. For more information, see Single-artifact access.

Note: See View Manager (.NET) for information about the View Manager API, and View Manager (REST) for information about using this service through REST.

This page contains the following information:

Read a View

To read Field values on a View, you can use the Read() method on the View repository as illustrated in this code sample.

public static bool ReadView(IRSAPIClient proxy, int viewID, int workspaceID)
{
    proxy.APIOptions.WorkspaceID = workspaceID;
    // STEP 1: Create the View object.
    View viewObj = new View(viewID);
    // This will return all possible fields in the views collection.
    viewObj.Fields = FieldValue.AllFields;
    ResultSet<View> viewReadResults = new ResultSet<View>();

    // STEP 2: Try to read the View.
    try
    {
        viewReadResults = proxy.Repositories.View.Read(viewObj);
    }
    catch (Exception ex)
    {
        Console.WriteLine("An error occurred reading the view: {0}", ex.Message);
    }
    // STEP 3: Check for success.
    if (!viewReadResults.Success)
    {
        Console.WriteLine("An error occurred reading the view: {0}", viewReadResults.Message);

        foreach (Result<View> readResult in viewReadResults.Results)
        {
            if (!readResult.Success)
            {
                Console.WriteLine(" An error occurred in read request: {0}", readResult.Message);
            }
        }
        return false;
    }
    // STEP 4: Display the results.
    Console.WriteLine("Successfully read the view '{0}'!", viewReadResults.Results[0].Artifact.Name);

    return true;
}

Query for a View

This code sample illustrates how to set query conditions, call the Query() method on the View repository, and iterate through the result set.

public static bool QueryView(IRSAPIClient proxy, int viewID, int workspaceID)
{
    proxy.APIOptions.WorkspaceID = workspaceID;

    // STEP 1: Create the Query criteria. Here the condition looks for any views with an Artifact ID.
    WholeNumberCondition queryCondition = new WholeNumberCondition("Artifact ID", NumericConditionEnum.IsSet);
    Query<View> viewQuery = new Query<View>();
    viewQuery.Condition = queryCondition;
    // This will return all possible fields in the views collection.
    viewQuery.Fields = FieldValue.AllFields;

    ResultSet<View> viewQueryResults = new ResultSet<View>();

    // STEP 2: Try to query for the View.
    try
    {
        viewQueryResults = proxy.Repositories.View.Query(viewQuery);
    }
    catch (Exception ex)
    {
        Console.WriteLine("An error occurred while querying: {0}", ex.Message);
    }
    // STEP 3: Check for success.
    if (!viewQueryResults.Success)
    {
        Console.WriteLine("An error occurred while querying: {0}", viewQueryResults.Message);

        return false;
    }
    // STEP 4: Display the results.
    foreach (Result<View> singleView in viewQueryResults.Results)
    {
        View singleViewArtifact = singleView.Artifact;
        Console.WriteLine("\r\nView Name: {0}\r\nView ID: {1}", singleViewArtifact.Name, singleViewArtifact.ArtifactID);
    }
    
    return true;
}

Additional Resources

DevHelp Community GitHub Release Notes NuGet

Share knowledge with the Relativity developer community.

Access tools and resources to build an application.

Review the most recent product release notes.

Create .NET Apps faster with NuGet.