Graph API com.microsoft.graph.models.Attachment attachment.isInline is retruning incorrect value

Srinivas Chikkala 0 Reputation points
2026-05-11T15:02:50.76+00:00

Issue description:

In the attached email, only 1 PDF is attached all other data/images supposed to be inline.

However, Graph API is returns attachment.isInline = false" which is not correct.

 

Confirmation and Workaround:

Can you confirm whether this is defect in Graph API or whether there are any workarounds suggested to filter out inline attachments in such emails.

 

Sample API Result 

// Used Graph API get email attachments

com.microsoft.graph.models.Attachment attachment = ...

// Results based on Graph API:

Outlook-ielmn2d3 / attachment.isInline = false

Outlook-3tsghtgq / attachment.isInline = false

Outlook-dozzenvr / attachment.isInline = false

Outlook-gtfv1tak / attachment.isInline = false

IE Retail Store Bill 1 4.pdf / attachment.isInline = false =============================================

 

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-05-11T15:03:05.7733333+00:00

    The behavior is consistent with how “inline” is defined and surfaced, not a confirmed Graph API defect in the provided context.

    Across Microsoft APIs, an attachment is considered inline only when it is explicitly marked as such in the message/attachment metadata. For example:

    • In EWS and related schemas, the IsInline flag indicates whether the attachment appears inline within an item, and the default is false unless explicitly set:
      • EWS XML element:
            <IsInline>true or false</IsInline>
        
        Default is false if not set.
      • EWS managed API property:
            public bool IsInline { get; set; }
        
        true only if the attachment is an inline attachment; otherwise false.
    • In UWP EmailAttachment, IsInline is a Boolean indicating if the attachment is included inline in the body of the message.
    • In other Microsoft Graph–related models (for example, MicrosoftGraphAttachmentItem in the Azure SDK), isInline is also documented as:

      true if the attachment is an inline attachment; otherwise, false.

    This pattern shows that isInline simply reflects whether the underlying item/attachment was stored with the inline flag set. If the message or client did not mark those images as inline (or if they are stored as regular file attachments even though the UI renders them in the body), attachment.isInline will correctly return false.

    Given the context:

    • The fact that the email visually shows images “inline” in Outlook does not guarantee that the server-side representation has isInline = true.
    • The Graph Attachment.isInline value being false for those Outlook-* items is therefore consistent with the general contract of IsInline in Microsoft APIs.

    Workaround to filter “inline-like” attachments when isInline is false: Because isInline may not be set, a practical workaround is to infer inline behavior using other properties (when available in the Graph attachment model), for example:

    1. Treat as inline if:
      • The attachment is an image type (e.g., JPEG, PNG, GIF), and
      • Its name or content ID suggests it is used in the body (e.g., cid: references in the HTML body, or typical Outlook naming patterns like image001.png, Outlook-*.png), and
      • It is referenced from the HTML body of the message (e.g., <img src="cid:..."> or <img src="Outlook-...">).
    2. Treat as “real” file attachments if:
      • The attachment is a document (PDF, Word, etc.) and not referenced in the HTML body, or
      • The user-facing filename is clearly a document the sender expects as a downloadable file (like IE Retail Store Bill 1 4.pdf).

    This logic mirrors how other Microsoft APIs and clients distinguish inline vs. regular attachments when IsInline is not reliably set.

    There is no explicit confirmation in the provided material that this is a Graph API defect. The behavior aligns with the documented semantics of IsInline/isInline: it is true only when the attachment is explicitly stored as inline; otherwise it remains false, even if the client UI renders it in the message body.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.