An API that connects multiple Microsoft services, enabling data access and automation across platforms
Hi Mayank Gupta,
Thank you for reaching out, Microsoft!
You can use below endpoint to read email attachments and mark an email as read using the Microsoft Graph API.
Part 1: Reading Email Attachments
Set Up Permissions:
- Ensure your application has
Mail.ReadorMail.ReadWritepermissions.
- Get the Message ID:
- Use the
list messagesAPI to retrieve emails from the inbox. This will give you the message IDs.
GET https://graph.microsoft.com/v1.0/me/messages - Use the
- Retrieve Attachments:
- Use the
list attachmentsAPI to get the attachments for a specific message.
GET https://graph.microsoft.com/v1.0/me/messages/{message-id}/attachments- Download Attachment:
- To download the attachment, use the
get attachmentAPI.
GET https://graph.microsoft.com/v1.0/me/messages/{message-id}/attachments/{attachment-id}/$value - To download the attachment, use the
- Use the
Part 2: Marking an Email as Read
- Set Up Permissions:
- Ensure your application has
Mail.ReadWritepermissions.
- Ensure your application has
- Mark as Read:
- Use the
update messageAPI to mark the email as read.
Please check below screenshot for details:PATCH https://graph.microsoft.com/v1.0/me/messages/{message-id}- Before Patch request:
- After Patch request to update isRead property:
Hope this helps. References:
Attachments Graph API
Update-Messages Graph API If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment. - Use the