Orchestrator Function: Get ResourceElement Content

by Simon Sparks · 20 January 2026

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

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

Filename: Utilities.ts

Function: GetResourceElementContent

Description: This function gets the string text content of a ResourceElement from Orchestrator.

public static GetResourceElementContent(strResourceElementCategoryName: string, strResourceElementName: string): string {

  let objResourceElementCategory: ResourceElementCategory = Server.getResourceElementCategoryWithPath(strResourceElementCategoryName);

  let arrResourceElement: ResourceElement[] = objResourceElementCategory.resourceElements;

  let objResourceElement: ResourceElement = arrResourceElement.find((objResourceElement: ResourceElement): boolean => {
    return objResourceElement.name === strResourceElementName;
  });

  let objMimeAttachment: MimeAttachment = objResourceElement.getContentAsMimeAttachment();

  let strMimeAttachmentContent: string = objMimeAttachment.content;

  return strMimeAttachmentContent;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like