
.msg file and then call that function from Power Automate using an HTTP action. In this solution, when a .msg file is uploaded to SharePoint and triggers the flow, the flow retrieves the file content and sends it (typically as base64) to an Azure Function endpoint. The Azure Function, written in Python using the extract_msg library, reads the Outlook message file, extracts the email subject, body, sender details, and all attachments (such as PDF and Excel files), and converts them into a structured JSON response. The function can return the email content as text and the attachments as base64-encoded files. Power Automate then receives this JSON response, processes each attachment accordingly (for example, sending the PDF to a document processing service or reading rows from the Excel file), and stores or uses the extracted data as needed. This architecture is scalable, secure, fully cloud-based, and ideal for enterprise-grade automation.