I am running into a bit of a snag attempting to retrieve the provisioningGroupId value while using vCACEntityManager.vCACEntityManager.readModelEntitiesBySystemQuery. The goal of this is to retrieve the business group a given VM is owned by. I am able to retrieve what appears to be all of the VMs VirtualMachineProperties with the exception of provisioningGroupId. I can see said ID if I use LINQPad to explore. I am hoping someone can shed some light on the subject, or perhaps provide a better means of obtaining the Business Group for a given VM. Any assistance would be quite appreciated.
Code used below to show properties from VM (note: vm name hard coded below just for testing purposes):
var hostid = vCACHost.id;
var modelName = "ManagementModelEntities.svc";
var linkName = "VirtualMachineProperties";
var vmEntity = vCACEntityManager.readModelEntitiesBySystemQuery(hostid, modelName, "VirtualMachines", "VirtualMachineName eq enttst0062'");
var linkEntity = vmEntity[0].getLink(vCACHost, linkName);
for each(var l in linkEntity){
System.log("key: " + l.getProperty("PropertyName"));
System.log("value: " + l.getProperty("PropertyValue"));
}