Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

How to get VappTemplate list

$
0
0

I am looking for a good way to ge ta list of all VappTemplates currently in the system.

 

I have a method that works, but is slow (takes 20-30 seconds).

 

Method I am using (looking for something better):

 

Seems to be a pain that I need to look at all the catalogs (and as shared catalos show for each org I am having to do api calls to load about 40 catalogs - I could cache ones we have loaded already to help, but still seems odd no better way to ask this of the API, so figured I had to be missing something)

 

Basic code struct

 

OrgList has all orgs in out system (10)


foreach Org in OrgList {

  OrgDetail = Organization.GetOrganizationByReference(Org)

  foreach (ReferenceType catReference in OrgDetail.GetCatalogRefs()) {

    catalog= Catalog.GetCatalogByReference(catReference);

//I only  want to return thingsi n shared catalogs - but as we are looking at all orgs need to not get items in catalogs that do not beloing to this ord at this point


    if (catalog.Resource.IsPublished && catalog.GetOrgReference().href.Equals(organizationReference.href))
    {
      foreach (ReferenceType catalogItemReference in catalog.GetCatalogItemReferences())
      {
        CatalogItem item = CatalogItem.GetCatalogItemByReference(_client, catalogItemReference);
        if (item.Resource.Entity.type.Contains("emplate+xml")) { WE GOT ONE, Add to list to return }

      }

   }

}


Viewing all articles
Browse latest Browse all 2039

Trending Articles



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