Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230656

Get vApp templates with single VM

$
0
0

Hi,

 

My requirement is to get all the vApp templates of a particular organization which have only 1 VM.

I tried with this but it didnt work.

 

         QueryService queryService = client.getQueryService();

          QueryParams<QueryVAppTemplateField> tParam = new QueryParams<QueryVAppTemplateField>();

 

            MetadataNumberValue number = new MetadataNumberValue();

            number.setValue(1);

            Expression expression = new Expression("numberOfVMs", number, MetadataExpressionType.EQUALS);

            Filter filter = new Filter(expression);

            tParam.setFilter(filter);

            

          for(ReferenceType t:queryService.queryvAppTemplateReferences(tParam).getReferences())

            {

            VappTemplate tTemplate = VappTemplate.getVappTemplateByReference(client, t);

            System.out.println(t.getName());

            }

 

I am not getting any result while executing this. Could you please let me how to do it using QueryService?

 

Thanks,

Reshmi


Viewing all articles
Browse latest Browse all 230656

Latest Images

Trending Articles



Latest Images