VMware {code} Community

How can i list all vapps in vcenter and get vms per vapp

Im trying to get a list of vapps using vb.net or c#

i started to build the traversal spec to go into the vapps, but i dont know how to filter only for vapps and then get the vms on a specific vapp.

Can anyone help?

'Traversal to get to the VM in a VApp
            Dim vAppToVM As New TraversalSpec()
            vAppToVM.name = "vAppToVM"
            vAppToVM.type = "VirtualApp"
            vAppToVM.path = "vm"

            'Traversal spec for VApp to VApp
            Dim vAppToVApp As New TraversalSpec()
            vAppToVApp.name = "vAppToVApp"
            vAppToVApp.type = "VirtualApp"
            vAppToVApp.path = "resourcePool"
            'SelectionSpec for VApp to VApp recursion
            Dim vAppRecursion As New SelectionSpec()
            vAppRecursion.name = "vAppToVApp"
            'SelectionSpec to get to a VM in the VApp
            'Since it is already defined earlier use it by its name
            'Can't use the same object
            Dim vmInVApp As New SelectionSpec()
            vmInVApp.name = "vAppToVM"
            'SelectionSpec for both VApp to VApp and VApp to VM
            Dim vAppToVMSS As SelectionSpec() = New SelectionSpec() {vAppRecursion, vmInVApp}
            vAppToVApp.selectSet = vAppToVMSS

0 Kudos
0 Replies