Skip to content

MS Teams: Inline images (Ctrl+V) in DMs not downloaded - Graph fallback fails #23453

@AxeerVienna

Description

@AxeerVienna

Problem

Inline images pasted with Ctrl+V in Teams DMs are detected by the plugin but never downloaded. The log shows:

"inline images detected but none downloaded"
"graph media fetch empty"

File attachments (paperclip icon) work fine.

Environment

  • OpenClaw: 2026.2.21-2
  • MS Teams plugin: 2026.2.21 (stock)
  • Bot type: Single-tenant, Application permissions
  • Graph permissions: Chat.Read.All, ChannelMessage.Read.All, Sites.ReadWrite.All, User.Read.All, Mail.Send — all admin-consented

Root Cause Analysis

The plugin code in inbound-media.ts first tries downloadMSTeamsAttachments() which attempts to download inline <img> URLs from HTML attachments. For Ctrl+V images in DMs, the img src is typically an asm.skype.com hosted content URL that requires authentication — this direct download fails.

The fallback path calls buildMSTeamsGraphMessageUrls() which constructs a Graph API URL using the conversationId from the Bot Framework activity. It then calls downloadMSTeamsGraphMedia() which fetches /hostedContents on that URL. This also returns empty.

However, manually querying the Graph API with the correct chat ID works perfectly:

GET /v1.0/chats/{chatId}/messages/{messageId}/hostedContents
→ Returns 1 hosted content item, 415KB image downloads successfully

The issue appears to be that the conversationId from the Bot Framework activity may not match the format expected by the Graph API chat endpoint, or there is a URL encoding issue when constructing the Graph message URL for DM conversations.

Steps to Reproduce

  1. Configure MS Teams bot with Chat.Read.All application permission
  2. Send a DM to the bot
  3. Paste an image with Ctrl+V (not as file attachment)
  4. Observe: text arrives but image is missing
  5. Check logs for "inline images detected but none downloaded" + "graph media fetch empty"

Expected Behavior

Inline pasted images in DMs should be downloaded via the Graph API hostedContents endpoint and forwarded to the agent.

Workaround

Use the file attachment button (paperclip) instead of Ctrl+V to send images to the bot.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions