I am looking to create a workflow where a user can select a ISO that is currently in a folder in a datastore. For instance the Datastore is [MyDatastore] and the folder is isos. There is iso1.iso, iso2.iso, iso3.iso inside this folder. How can I pull those filenames/paths into an array. I am assuming it will be in a configuration item? Thanks for your help.
Check the following sample code showing how to enumerate the files in a datastore folder:
var dsPath = "[MyDatastore] isos";
var task = ds.browser.searchDatastore_Task(dsPath);
var searchResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task, null, 2);
for each (var file in searchResult.file) {
System.log(file.path);
}
Check the following sample code showing how to enumerate the files in a datastore folder:
var dsPath = "[MyDatastore] isos";
var task = ds.browser.searchDatastore_Task(dsPath);
var searchResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task, null, 2);
for each (var file in searchResult.file) {
System.log(file.path);
}