I’m working on a project where we need to fetch incoming emails using Matillion and load the email content into our Snowflake data warehouse. Our company has set up a dedicated mailbox (mb_xyz@outlook.com) on Microsoft Office 365 for this use case. To achieve this, I used the Microsoft Exchange Query component in Matillion, where I successfully set up authentication with Azure Active Directory (AAD) using the Manage OAuth feature in Matillion. I also configured the connection to load the fetched data into a Snowflake table via a managed stage in AWS S3.
Successfully able to query and load data into Snowflake from Inbox, Contacts, and Groups when selecting them as the Data Source. But When I try to fetch data using Messages/MessageAttachments as the Data Source, the component fails with the following error:
[MailboxNotEnabledForRESTAPI] The mailbox is either inactive, soft-deleted, or is hosted on-premise.
I need to query the necessary fields, such as ID, subject, body_content, etc., from Messages/MessageAttachments in the mailbox (mb_xyz@outlook.com). How can I resolve this error and successfully query email messages and attachments? Could someone provide the correct SQL-like syntax to retrieve these records using the Microsoft Exchange Query component?