Retrieving Relationship Collections

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

To retrieve a collection of relationships using Automation interfaces

  1. Declare a variable as an object that implements the IRelationshipCol interface.

  2. Set it 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 IRelationshipCol
DIM Person As RepositoryObject

...Retrieve the source object into the Person variable...

Set DiscoveryCollection = Person.bugs

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

To retrieve a collection of relationships using COM interfaces

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

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

  3. 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.

  4. Invoke the QueryInterface method of the IDispatch interface to retrieve an IRelationshipCol interface pointer for the collection of relationships.
(c) 1988-1998 Microsoft Corporation. All Rights Reserved.