I am using the Outlook Mail REST API to get JSON objects of a collection of a user's emails and display the data in a custom web interface. I need to show a list of emails, and each email in the list needs an indicator of the NUMBER of attachments for that particular email.
I am using the Get Messages from Outlook Mail REST API reference #Getmessages route to get all of the data I need to do this. However when I specify in my $select that I want Attachments, I never get the Attachment collection for each email; it's just missing.
I can get the attachment collections for each individual email with an individual request for each email, which will be ugly if I need Attachment counts for 100 emails at once.
According to this: (https://msdn.microsoft.com/office/office365/api/complex-types-for-mail-contacts-calendar#RESTAPIResourcesMessage) I should be able to specify if I want the attachment collection when I Get Messages, but it isn't working. I am using Node.js to get the email collection:
var requestUrl = "https://outlook.office.com/api/v2.0/me/messages";
var queryParams = {
'$select': 'Subject, ReceivedDateTime, From, ToRecipients, HasAttachments, Attachments, WebLink, CcRecipients, Body',
'$orderby': 'ReceivedDateTime desc',
'$filter' : dateString,
'$top': 300
};
...
Returned Email Object in Collection
Every option in $select is working correctly if I include it or exclude it, but Attachments is always missing. Does anyone have a solution?