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

Not able to retrieve vcloud director host sys admin user reference

$
0
0

i am trying to retrieve vcloud director host system admin user reference for using this user for performing automation tasks.

 

But resultset is not retrievable with below code. Is there any other way to retrieve Sys Admin User reference?

 

 


var expressionUser = new VclExpression(VclQueryAdminUserField.NAME, host.getUsername(), VclExpressionType.EQUALS);

var filter = new VclFilter(expressionUser);
var params = new VclQueryParams();

params.setFilter(filter);

var users = new Array();

var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINUSER, params);

while (resultSet != null)  {
    var records = resultSet.getRecords(new VclQueryResultAdminUserRecord());
    System.log(records.length + " Admin User record found");
    for each (var record in records) {
        var userRef = new VclReference();

    System.log(record.href + " href");
    System.log(record.name + " name");
    System.log(record.type + " type");

        userRef.href = record.href;
        userRef.name = record.name;
  userRef.type = record.type;

       users.push(host.getEntityByReference(VclFinderType.USER, userRef));
    }
    resultSet = resultSet.getNextPage();
}


Viewing all articles
Browse latest Browse all 252940

Trending Articles



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