[Outlook Email Connector] Shared-mailbox attachments target the signed-in mailbox and fail with ErrorInvalidMailboxItemId

Open 💬 0 comments Opened Jul 9, 2026 by mariusfriess

What issue are you seeing?

The Outlook Email integration can list and fetch messages from a delegated/shared mailbox, but it cannot list or fetch attachments from those messages.

Shared-message actions preserve mailbox_user_principal_name. The attachment actions do not accept a mailbox target, so a shared message ID is resolved against the signed-in user's mailbox instead. The result is:

HTTP 404
ErrorInvalidMailboxItemId: Item '<redacted-message-id>' doesn't belong to the targeted mailbox '<redacted-mailbox-id>'.

This blocks attachment-dependent shared-mailbox workflows even though the same user can read the message and open/download its attachments in Outlook Web.

I reproduced the following controls:

  • fetch_shared_message succeeds for the shared message and reports has_attachments: true.
  • list_attachments fails for that shared message ID with the error above.
  • list_attachments and fetch_attachment work for messages in the signed-in user's own mailbox.
  • Outlook Web can preview/download the same attachment from the shared mailbox.

What steps can reproduce the bug?

Prerequisites:

  • Connect the Outlook Email plugin with an account that has access to a delegated/shared mailbox.
  • Ensure the shared mailbox contains a message with a normal file attachment.

One user-level prompt that reproduces the issue is:

Use the Outlook Email plugin. In the shared mailbox shared@example.com,
open a recent message with an attachment and read the attachment.

The resulting connector sequence is:

1. list_shared_messages(
     mailbox_user_principal_name="shared@example.com",
     filter="hasAttachments eq true"
   )

2. fetch_shared_message(
     mailbox_user_principal_name="shared@example.com",
     message_id="<shared-message-id>"
   )
   # Succeeds; has_attachments is true.

3. list_attachments(
     message_id="<same-shared-message-id>"
   )
   # Fails with HTTP 404 ErrorInvalidMailboxItemId.

There is no shared-aware attachment action to use instead. The current list_attachments schema accepts only message_id; fetch_attachment accepts only message_id and attachment_id.

What is the expected behavior?

Attachments on delegated/shared mailbox messages should be listable and retrievable while preserving the mailbox context used to obtain the message ID.

Either of these API shapes would address the gap:

  • allow list_attachments and fetch_attachment to accept an optional mailbox_user_principal_name; or
  • add list_shared_attachments and fetch_shared_attachment actions.

For shared messages, the connector should route through the Microsoft Graph user-specific path, for example /users/{shared-mailbox-UPN}/messages/{message-id}/attachments, rather than resolving the shared message ID under the signed-in user's mailbox.

Additional information

Environment where reproduced:

  • Codex App 26.707.30751 (build 5018)
  • Outlook Email plugin 0.1.5
  • Darwin 25.5.0 arm64 arm / macOS 26.5
  • Observed 2026-07-09 around 22:44 CEST

Root-cause hypothesis: this appears to be a mailbox-routing gap in the attachment actions, not an attachment-permission problem. Shared message actions carry mailbox_user_principal_name, whereas the attachment actions expose no mailbox parameter; the returned error shows that the shared message ID was evaluated against the signed-in mailbox. Microsoft Graph supports the needed user-specific attachment routes:

  • [https://learn.microsoft.com/en-us/graph/api/message-list-attachments?view=graph-rest-1.0](<https://learn.microsoft.com/en-us/graph/api/message-list-attachments?view=graph-rest-1.0>)
  • [https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0](<https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0>)

Relevant OpenAI context:

  • [https://github.com/openai/plugins/pull/127](<https://github.com/openai/plugins/pull/127>)
  • [https://github.com/openai/plugins/blob/main/plugins/outlook-email/skills/outlook-email-shared-mailboxes/SKILL.md](<https://github.com/openai/plugins/blob/main/plugins/outlook-email/skills/outlook-email-shared-mailboxes/SKILL.md>)

I searched open and closed openai/codex issues for the exact error and for shared-mailbox/Outlook attachment reports. I found no exact duplicate. Issue openai/codex#19489 is related to mailbox context but does not cover attachment actions or this error.

Current workaround: open or download the attachment through Outlook Web. No mailbox addresses, message IDs, attachment IDs, mailbox GUIDs, subjects, message bodies, or attachment contents in this report are real; all identifiers above are placeholders.

View original on GitHub ↗