Retrieving Object Collections

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

To retrieve a collection of objects using Automation interfaces

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

  2. Set it equal to the object member that is the collection you want to retrieve.

Note   All collections in Microsoft® Repository are attached to Repository objects as members.

For example, the following Microsoft Visual Basic® code retrieves a collection of bugs (a target object collection) discovered by a particular person into the variable called BugCollection.

DIM BugCollection As ITargetObjectCol
DIM Person As RepositoryObject
...
REM Retrieve the source object into the Person variable
...
Set BugCollection = Person.bugs

In this example, BugCollection(1) would refer to the first object in the collection.

To retrieve a collection of objects 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 ITargetObjectCol interface pointer for the collection of target objects.
(c) 1988-1998 Microsoft Corporation. All Rights Reserved.