VMware Global Community
FTVDaniel
Contributor
Contributor

what is the best way to work with files in orchestrator

Hello

I need to work with files on cifs share from  a workflow

1 moving csv, pdf, xls, docx files from folder to folder in a folder tree

2 using some files from this folder tree to add them in mails sent by a workflow

I need help to find the best way to address this subject

the constraint is that the folder tree root is not a windows share (I am not allowed to  create shares on this file server)

so I can not add this folder tree as a mount in VCO

I can see workflows in VCO that can address part of this work but not all

in  library/ guest operations/files there is a wf moving files to guest

it uses vcGuestOperationsManager scripting class

and it is able to work with UNC path as source and destination so it is perfect for my moving part

I use an admin vm for this work

but how can I  use one of the files to send it by mail (attached file)?

perhaps there are other best methodes to address my need ?

0 Kudos
1 Reply
mhampto
VMware Employee
VMware Employee

Using the below script may help you to send the file as an attachment(please change the variables as needed):

var objMimeAttachment;

objMimeAttachment = new MimeAttachment();

objMimeAttachment.name = "DeploymentReport.pdf";

objMimeAttachment.content = strReportJson;

var objEmailMessage;

objEmailMessage = new EmailMessage();

objEmailMessage.fromAddress = "vco@domain.com";

objEmailMessage.fromName = "vCloud";

objEmailMessage.smtpHost = "smtp.domain.com";

objEmailMessage.smtpPort = "25";

objEmailMessage.subject = strSubject;

objEmailMessage.toAddress = strToAddress;

objEmailMessage.addMimePart(strContent, "text/html");

objEmailMessage.addMimePart(objMimeAttachment, "application/json; charset=UTF-8");

objEmailMessage.sendMessage();

(or)

Alternatively, you may use runWorkflowWithMimeInput.ps1  (Sample script that shows how to send a small file as input for a MimeAttachment input. The data file for this one is a csv file that gets parsed by the Orchestrator workflow) from GitHub - burkeazbill/vroClientScripts: REST Client Script examples 

0 Kudos