Retrieving Relationship Collections

Meta Data Services Programming

Meta Data Services Programming

Retrieving Relationship Collections

Relationship collections can be retrieved at both the COM and Automation level.

Retrieving Relationship Collections Using Automation Interfaces

To retrieve a relationship, first declare a variable as a RelationshipCol object (that is, an object that implements the IRelationshipCol interface). Next, set the variable equal to the object member that is the collection you want to retrieve.

For example, the following Microsoft® Visual Basic® code retrieves a collection of bug discoveries (a relationship collection) belonging to a particular person into the variable called DiscoveryCollection:

DIM DiscoveryCollection As RelationshipCol
DIM Person As RepositoryObjectVersion
REM Retrieve the source object into the Person variable
Set DiscoveryCollection = Person.bugs

In this example, DiscoveryCollection(1) refers to the first relationship in the collection.

Retrieving Relationship Collections Using COM Interfaces

To retrieve a relationship, you can perform the following steps:

  • Call the Invoke method of the interface to which the collection is attached.

  • Pass in DISPATCH_PROPERTYGET to specify that this is a property-get operation.

  • Pass in the dispatch identifier for the collection to be retrieved.

    The Invoke method will pass an IDispatch interface pointer for the collection back to you.

  • Invoke the QueryInterface method of the IDispatch interface to retrieve an IRelationshipCol interface pointer for the relationship collection.

See Also

Navigating a Repository