- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Content translations are temporarily unavailable due to site maintenance. We apologize for any inconvenience. Visit our blog to learn more.
06-06-2024 12:36 AM
I have an array of hostnames, which I want to then turn into an attachment and then send by email using the O365 integration.
If I put ${array} into the body, it will loop and send an email for each element of the array. If I do ArrayToCSV, it then just sends a comma separated line of host names.
What I really want to do is create a file with a header (hostname) and then a line for each host name in the array, which I can then use as an attachment Id in the O365 integration, and I'm struggling. Are there any automations that I can use to do this?
06-06-2024 09:45 PM - edited 06-06-2024 09:46 PM
Hi @bowesmana, you're going to have to split this into 2 steps. One to the make the file and the other to send it. Since you did not specify a format, I'll assume .txt should work.
1. You can use the FileCreateAndUpload function. This will return a file object to the warroom. You can then use this entryID to attach to the email.
2. List created in content and references in "Get" section.
3. I've used ArrayToCSV, but you can use anything that merges your content. Join, append, stringfy, etc.
4. Since you wanted a title.
5. Command output, file output below.
06-06-2024 11:04 PM
Thanks @jfernandes1 I ended up writing a short Python automation - in your solution it joins the rows into a single row, but I wanted the host on a new line, so I can effectively export that as a file that others can load into a some tool to view, it has around 10,000 entries so not useful on one line.
Appreciate the learning - thanks!
06-10-2024 07:08 PM
Hi @bowesmana, in my previous example, you can swap the ArrayToCSV for the Join transformer. In the Join set the delimiter to the enter or return key. This will add each entry on a new line.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!