Function: vCenter VAPI Plugin Content Library Item Get ID By Name

by Simon Sparks · 29 March 2026

To use this function add it to the class library file named vCenterVAPIService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vCenterVAPIService.ts

Public Function: ContentLibraryItemGetIDByName

public ContentLibraryItemGetIDByName(strTemplateName: string): string {

    let objVMwareContentLibraryItem: com_vmware_content_library_item = new com_vmware_content_library_item(this.objVAPIClient);

    let objVMwareContentLibraryItemFindSpec: com_vmware_content_library_item_find__spec = new com_vmware_content_library_item_find__spec();
    objVMwareContentLibraryItemFindSpec.name = strTemplateName;

    let arrVMwareContentLibraryItemID: string[] = objVMwareContentLibraryItem.find(objVMwareContentLibraryItemFindSpec);

    let strVMwareContentLibraryItemID: string = arrVMwareContentLibraryItemID.shift();

    return strVMwareContentLibraryItemID;
}
TypeScript

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like