Quantcast
Channel: VMware Communities: Message List - vSphere Management SDK
Viewing all articles
Browse latest Browse all 2052

Re: C# application using vSphere SDK 5.5 fails to retrieve VM's data from VMware ESXi 4

$
0
0

No, that property works just fine. It fails for datasore and vm property. And I need them to find out the details of vm associated with each host. I am trying the below logic to handle these properties:

 

                      DynamicProperty[] pcary = null;

                      pcary = oc.propSet;

 

 

                      for (int i = 0; i < pcary.Length; i++)

                      {

                          pc = pcary[i];

                      

                              if ((pc.val.GetType() == typeof(Vim25Api.ManagedObjectReference[])))

                           

                              {

                                  Vim25Api.ManagedObjectReference[] dsList = (ManagedObjectReference[])pc.val;

                                  Vim25Api.ManagedObjectReference dsRef = null;

 

 

                                  for (int j = 0; j < dsList.Length; j++)

                                  {

                                      dsRef = dsList[j];

 

 

                                      if (dsRef.type.Equals("VirtualMachine"))

                                      {

                                          StringBuilder VM_Info2 = getvCenterVMsData(dsRef);

                                          VM_Info.Append(VM_Info2).Append("<VM>");

                                      }

                                      else

                                      {

                                          //ManagedObject is a datastore

                                          Object[] dsProps = getProperties(dsRef, new String[] { "summary.capacity",

                                                                                           "summary.freeSpace",

                                                                                            "summary.name",

                                                                                            "summary.type",

                                                                                            "summary.url"

                                                                                                        });


Viewing all articles
Browse latest Browse all 2052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>