I have an email in Outlook (Exchange) and hope that it is possible to read the emails with FME Desktop.
Does anyone now how to do that?
Regards,
Morten Friis
I have an email in Outlook (Exchange) and hope that it is possible to read the emails with FME Desktop.
Does anyone now how to do that?
Regards,
Morten Friis
As far as I know there is no such native capability in FME Desktop, but I'm confident it should be doable without too much effort:
Feel free to ask again here if you get stuck somwhere.
Hello @ikast_mofri,
Im looking to accomplish the exact same thing .
Have you had any luck figuring this out ?
HI,
has anyone tried the method described by
Thanks!
I’m not sure if you can still use POP, especially on Exchange for Office 365. You can try to using the MS Graph API, which is what Microsoft recommends. Here’s an example in Python:
import requests
from msal import ConfidentialClientApplication # You'll need to install "msal" first
# App registration details from Azure AD
client_id = 'your_client_id'
client_secret = 'your_client_secret'
tenant_id = 'your_tenant_id'
# Create MSAL app
app = ConfidentialClientApplication(
client_id,
authority=f"https://login.microsoftonline.com/{tenant_id}",
client_credential=client_secret
)
# Get token
scope = e'https://graph.microsoft.com/.default']
result = app.acquire_token_for_client(scopes=scope)
access_token = results'access_token']
# Read emails
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}
# Get messages from a specific user's mailbox
user_email = 'user@domain.com'
endpoint = f'https://graph.microsoft.com/v1.0/users/{user_email}/messages'
# Optional: Add filters and select specific fields
params = {
'$filter': "receivedDateTime ge 2024-01-01",
'$select': 'subject,from,receivedDateTime,body',
'$top': 10,
'$orderby': 'receivedDateTime desc'
}
response = requests.get(endpoint, headers=headers, params=params)
messages = response.json()
for message in messages.get('value', e]):
print(f"Subject: {messages'subject']}")
print(f"From: {messages'from']o'emailAddress']s'address']}")
print(f"Date: {messages'receivedDateTime']}")
print("-" * 50)
Since FME has its own FME service defintion for the Graph API, you should even be able to use it using HTTPCallers, if Python is not your thing: https://hub.safe.com/publishers/safe-lab/web-connections/microsoft-graph