Use Recursive
TraversalSpec to Traverse Nested Inventory Folders
To traverse inventory objects that are
nested to a variable depth, define one or more recursive
TraversalSpec
objects. In each
TraversalSpec
object, you specify a property of one
managed object that holds a reference to another managed object. The
TraversalSpec
defines a path that the property collector
can follow between objects.
To define recursive inventory traversal, use the
following steps.
- Use theSearchIndexmanaged object to retrieve the managed object reference for the top-level virtual machine folder.This folder is used as the beginning of the inventory traversal. For more information see SearchIndex.
- Create anObjectSpecobject that references the top-level virtual machine folder.
- Create aSelectionSpecobject that references theFolder TraversalSpecby name.
- Create a namedTraversalSpecforFolderobjects.TheTraversalSpec.pathproperty identifies theFolder.childEntityproperty for traversal to any child objects.
- Add theSelectionSpecto theTraversalSpecto create the recursive filter.
- Add theTraversalSpecto theObjectSpec.
- Create aPropertySpecfor theFoldername.
- Add the object and property specifications to thePropertyFilterSpec.
- Call theRetrievePropertiesExmethod.