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

Layout

In Relativity, layouts are web-based coding forms that enable users to view and edit document fields. For more information, see Layouts on the Relativity Documentation site.

The Services API supports read and query operations on a Layout DTO.

Note: You can also read layouts using the common DTO ReadSingle method. For more information, see Single-artifact access.

This page contains the following information:

Read a Layout

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

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

    Layout LayoutObj = new Layout(LayoutID);
    LayoutObj.Fields = FieldValue.AllFields;
    ResultSet<Layout> LayoutReadResults = new ResultSet<Layout>();

    try
    {
        LayoutReadResults = proxy.Repositories.Layout.Read(LayoutObj);
    }
    catch (Exception ex)
    {
        Console.WriteLine("An error occurred reading the Layout: {0}", ex.Message);
    }

    if (!LayoutReadResults.Success)
    {
        Console.WriteLine("An error occurred reading the Layout: {0}", LayoutReadResults.Message);

        foreach (Result<Layout> readResult in LayoutReadResults.Results)
        {
            if (!readResult.Success)
            {
                Console.WriteLine(" An error occurred in read request: {0}", readResult.Message);
            }
        }
        return false;
    }
    Console.WriteLine("Successfully read the Layout '{0}'!", LayoutReadResults.Results[0].Artifact.Name);

    return true;
}

Query for a Layout

To query for a Layout, you can use the fields listed in the following table. For more information, see Search Relativity.

Fields for Layout queries
ArtifactID Notes
Created By Object Type
Created By Order in Dropdown
Keywords Overwrite Protection
Last Modified By Owners
Last Modified On Relativity Applications
Name Security

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

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

    WholeNumberCondition queryCondition = new WholeNumberCondition("Artifact ID", NumericConditionEnum.IsSet);
    Query<Layout> layoutQuery = new Query<Layout>();
    layoutQuery.Condition = queryCondition;
    layoutQuery.Fields = FieldValue.AllFields;

    ResultSet<Layout> layoutQueryResultSet = new ResultSet<Layout>();

    try
    {
        layoutQueryResultSet = proxy.Repositories.Layout.Query(layoutQuery);
    }
    catch (Exception ex)
    {
        Console.WriteLine("An error occurred while querying: {0}", ex.Message);
    }

    if (!layoutQueryResultSet.Success)
    {
        Console.WriteLine("An error occurred while querying: {0}", layoutQueryResultSet.Message);

        return false;
    }
    foreach (Result<Layout> singleLayout in layoutQueryResultSet.Results)
    {
        Layout singleLayoutArtifact = singleLayout.Artifact;
        Console.WriteLine("\r\nLayout Name: {0}\r\nLayout ID: {1}", singleLayoutArtifact.Name, singleLayoutArtifact.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.