ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / Geodatabase Class / OpenRelationshipClasses Method / OpenRelationshipClasses(Table,Table) Method
The origin table/feature class in the relationship.
The destination table/feature class in the relationship.
Example Version

OpenRelationshipClasses(Table,Table) Method
Gets a IReadOnlyList of specific RelationshipClass or AttributedRelationshipClass instances associated with the originTable and the destinationTable where originTable is the origin table/feature class and destinationTable is the destination table/feature class. This method must be called on the MCT. Use QueuedTask.Run.
Syntax

Parameters

originTable
The origin table/feature class in the relationship.
destinationTable
The destination table/feature class in the relationship.

Return Value

Exceptions
ExceptionDescription
No valid geodatabase has been opened prior to calling this operation.
originTable or destinationTable is null.
A geodatabase-related exception has occurred.
Remarks
This routine works with regular RelationshipClasses as well as AttributedRelationshipClasses.
Example
Opening RelationshipClass between two Tables
// Must be called within QueuedTask.Run().  
// When used with file or enterprise geodatabases, this routine takes two table names.
// When used with feature services, this routine takes layer IDs, or the names of the tables as they are exposed through the service (e.g., "L0States")
public IReadOnlyList<RelationshipClass> OpenRelationshipClassFeatureServices(Geodatabase geodatabase, string originClass, string destinationClass)
{
    return geodatabase.OpenRelationshipClasses(originClass, destinationClass);
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also