emailoutlookmicrosoft-graph-apiemail-attachmentsinline-attachments

Understanding 'hasAttachments' Property in Graph API: Anomalies with Inline Attachments


I'm working with the Microsoft Graph API to retrieve message details from Outlook, where I found something odd with the property "hasAttachments".

Typically, the "hasAttachments"

is set to true :

is set to false in the following two scenarios:

There is a property called "isInline" which is set to true if a attachment is inline.

Case scenario:

However, The response I'm getting from Graph API seems not as expected.

I encountered a scenario for a message containing an attachment that is not an inline attachment but in the Graph API response both the properties "hasAttachment" and "isInline" were false.

usually if a message has a non-inline attachment the "hasattachment" property will be true but it some of my cases it is set to be false. I have attached the copy of my response in a link below

{
    "@odata.etag" : "W/\"CQAAABYAAABEIDZQDkY9Q11HVLaaS/ZVAAEWzqBC\"",
    "id": "AAMkADk40TYXNzhjLWE5yzgtNGE5N..."
    "hasAttachments": false,
    "attachments": [
        {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "@odata.mediaContentType": "application/x-microsoft-rpmsg-message",
            "id": "AAMkADk40TYXNzhjLWE5yzgtNGE5NS1hYTd1LT1iZELuw="
            "lastModifiedDateTime": "2023-06-22T09:57:48z",
            "name": "message_v2.rpmsg",
            "contentType": "application/x-microsoft-rpmsg-message",
            "size": 118679,
            "islnline": false,
            "contentld": "21672D7F295E8B4D9e9C6CBD4E7EIBCB@1NDPRDØ1.PROD.OUTLOOK.COM",
            "contentLocation": null,
            "contentBytes": "qne533e9362efp6d/124Y7fJOK/QgvBg....."

enter image description here

The query I used in Graph explorer:

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$select=hasAttachments&$expand=attachments

I would appreciate any guidance on what I might be missing or if there's something I'm doing wrong. Thank you in advance for your help!


Solution

  • That attachment is listed as an application/x-microsoft-rpmsg-message which (if you had the "raw" e-mail in its orignal MIME format instead of MS Graph's JSON representation) would be an "Alternative View" of the body of this MIME e-mail - which is why it isn't considered an "attachment" by the MS Graph.