0

I am new to Microsoft Graph API. The requirement on our application is to collect the latest email based on expected subject and collect the attachment of the email (CSV format).

This is working fine already when using the queries below but using 2 GET requests:

First is for collecting the latest email:

https://graph.microsoft.com/v1.0/me/messages?$select=id,hasAttachments&$top=1&$filter=subject eq '{subject}'

Second is for collecting the attachment by passing the id returned from the first query:

https://graph.microsoft.com/v1.0/me/messages/{id}/attachments

Question: Is there a way to just merge this request into one to make the code even better?

Thank you!

2 Answers 2

1

Update: I was able to merge two requests with the user of $expand parameter:

https://graph.microsoft.com/v1.0/me/messages?$select=id,hasAttachments&$top=1&$filter=subject eq '{subject}'&$expand=attachments

Sign up to request clarification or add additional context in comments.

Comments

0

To my current knowledge, there isn't a way to merge these two requests. As you have pointed out, the message id is required to list attachments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.