How to get a latest email conversation message and its attachments only either it is a reply or single email? Now, GraphAPI is gives latest email thread , so the entire conversations coming inside the body ? Any way to achieve this

Yabesh 0 Reputation points
2024-06-15T04:35:45.8133333+00:00

The below code I have tried, usually the entire conversation messages inside the single email thread is coming inside the body as a html, but I want the latest reply email conversation message and with its attachments only, not the previous conversation messages inside that same email thread. Please let me know, how to achieve this?


folder_url = f'https://graph.microsoft.com/v1.0/me/mailFolders/{folder}/messages?$top=1&$orderby=receivedDateTime desc'
        folder_r = requests.get(folder_url, headers=headers)
Outlook
Outlook
A family of Microsoft email and calendar products.
3,247 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,124 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. akinbade abiola 6,020 Reputation points
    2024-06-15T06:48:17.9366667+00:00

    Hello Yabesh,

    Maybe try this? https://stackoverflow.com/questions/59743062/microsoft-graph-get-latest-message-content-only

    Regards,

    You can mark it 'Accept Answer' if this helped you