Use the Save email to file stream action in the Microsoft 365 Outlook package to stream an email directly into a file variable instead of saving it to a local file path.
Use this action inside a Loop action to iterate through emails and stream each one into a file variable, which you can then pass as input to another action, such as uploading the email to an application or a REST API endpoint.
For more information about file streaming using the file variable, see File streaming using file variable.
Settings
- In the Microsoft 365 Outlook session field, select one of the
following options:
- Session name: Enter the session name specified in the Connect action.
- Variable: Select a session variable to share the Microsoft 365 Outlook session with other child bots.
- In the Outlook message ID field, enter the message ID of the email
that you want to save as a file stream.Note: The Outlook message ID is retrieved automatically when you use this action within a Loop action. The loop action populates the email properties, including the message ID in a dictionary variable. You can access the message ID using the
emailIDdictionary key. - In the Assign output to file variable field, select or create a file variable.
Example
Archive emails to an external application using file stream
The following example shows how to use the Save email to file stream action within a Loop action to stream emails and upload them to an external endpoint using the REST Web Services: Post method action.
- Use the Connect action to establish a Microsoft 365 Outlook session.
- Use a Loop action to iterate through emails in the specified folder.
- Inside the loop, use the Save email to file stream
action:
- In the Microsoft 365 Outlook session field, select the session created in the Connect action.
- In the Outlook message ID field, insert the
emailIDvalue from the dictionary variable populated by the loop. - In the Assign output to file variable field,
select or create a file variable (for example,
emailFileStream).
- Use the REST Web Services: Post method action to upload
the file variable (
emailFileStream) to the target endpoint, such as an OpenText server. - Use the Disconnect action to end the Microsoft 365 Outlook session.