Get the output of demisto.results() inside an automation for "msgraph-download-file"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Get the output of demisto.results() inside an automation for "msgraph-download-file"

L4 Transporter

Hello,

We'd like to use the command "msgraph-download-file" insde an automation, then use the FileID to import a csv and finally convert it to pandas. The problem we find is that the output of "msgraph-download-file" is completely different when it's is used inside an automation.

How can we get this file inside an automation?

5 REPLIES 5

L4 Transporter

Josep_0-1684500120813.png

 

L4 Transporter

How about just opening the file with the automation after the playbook downloads and returns it?

 

Pass in the entryid of the file to the automation, and just have the automation go open it?

 

entry_id = demisto.args().get('entry_id')

res = demisto.getFilePath(entry_id)
if not res:
    return_error("No file with that entry id found")

file_path = res.get("path")

with open(file_path, 'rb') as f:
    data = f.read()

# do something with the data.

 

 

Thanks for the response,

we'd like to all the process inside the automation, download the file, open it and finally convert it to pandas.


Thank you very much for answering,

the key is that we would like to be able to directly use the "msgraph-download-file" command inside the automation, without the need to create a playbook with a task using the function to set the "File" in the context.We'd like to use the direct output of:

demisto.executeCommand("msgraph-download-file" ,{vars})

The problem is that the direct output of msgraph-download-file is *not* a file, it's a war room entry which contains a reference to a file. Until that war room entry has been written and the file reference is usable, it's not possible to get the data contained in the file. The only way to do that is to have two separate tasks, which requires a playbook.

 

If you absolutely can't use a playbook for some reason, the only option I see is to modify the integration to add a variant of msgraph-download-file which does the required pandas processing before returning anything.

  • 2634 Views
  • 5 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!