I'm trying to figure out which property name to use while defining a PropertySpec object to search by moref ID. I'm buildling a plug-in for vSphere and the value that is sent to the webapp looks like this: moref=VirtualMachine:vm-87
I'd like to use that value as my search criteria while building the PropertySpec object (VirtualMachine:vm-87 or vm-87). I see the MOB browser displays the ID for all the objects, but for the life of me I can't figure out what attribute to use.
All examples that I can see in the SDK will do a search using "name".
Thanks,
Marc
If you already have the mo-ref, you don't need to search for the object: the mo-ref, after all, is
what you get back from the PropertyCollector in an ObjectContent:
If what you want is to get values of the properties of that object, you put the mo-ref into the
ObjectSpec portion of the PropertyFilterSpec, and set the PropertySpecs to the properties
you want.
In VI Java it would look something like this (sorry, not tested even for syntax):
ManagedObjectReference mo = new ManagedObjectReference();
mo.setType("VirtualMachine");
mo.set_value("vm-87");
ObjectSpec os = new ObjectSpec();
os.setObj(mo);
PropertySpec ps = new PropertySpec();
// ... set properties to retrieve
ObjectSpec[] oss = new ObjectSpec[] {os};
PropertySpec[] pss = new PropertySpec[] {ps};
PropertyFilterSpec pfs = new PropertyFilterSpec();
pfs.setObjectSet(oss);
pfs.setPropSet(pfs);