Skip to content

Share chat attachments with the chat's members after upload - #93

Open
philipwilsonTHG wants to merge 1 commit into
osodevops:mainfrom
philipwilsonTHG:chat-attach-share
Open

Share chat attachments with the chat's members after upload#93
philipwilsonTHG wants to merge 1 commit into
osodevops:mainfrom
philipwilsonTHG:chat-attach-share

Conversation

@philipwilsonTHG

@philipwilsonTHG philipwilsonTHG commented Sep 4, 2026

Copy link
Copy Markdown

Problem

teams message send --chat … --attach FILE uploads the file into the sender's OneDrive (Microsoft Teams Chat Files) and links the driveItem from the message, but nobody else in the chat can open it: the Teams client grants every chat member read permission when it attaches a file, and the CLI did not. Recipients saw "you don't have permission".

Fix

After each chat upload the CLI now lists the chat's members once and grants them read access through the driveItem's invite action (roles: ["read"], requireSignIn: true, sendInvitation: false — no notification email). Members are addressed by Entra object ID where the membership carries one (covers accounts without a mail attribute), else by email; the sender and members with neither are skipped, and duplicates collapse.

The grant is best-effort: if it fails (for example a token that cannot list chat members) the upload and message still go through and a warning on stderr says to share the file from OneDrive by hand. Channel attachments are unchanged — they live in the team's SharePoint library, which channel members already read.

Changes

  • AttachDestination::Chat carries the chat id so the media layer can look the members up.
  • New endpoints::me_drive_item_invite, DriveInviteRequest / DriveRecipient / DrivePermission models, files::grant_read_access.
  • Unit tests for recipient selection and the invite request's JSON shape.
  • Docs: command reference, attachments spec (new step 3 under Graph mechanics), CHANGELOG.

Verified

Live in a four-member chat: the debug log reports the file shared with 3 members and Graph lists a read permission for each of them, with the sender as owner.

🤖 Generated with Claude Code

`message send --chat … --attach FILE` uploads into the sender's OneDrive
("Microsoft Teams Chat Files") and links the driveItem from the message, but
nobody else could open it: the Teams client grants every chat member read
permission when it attaches a file, and the CLI did not. Recipients saw
"you don't have permission" (observed live, 2026-09-03).

After each chat upload the CLI now lists the chat's members once and grants
them read access through the driveItem's `invite` action, with
requireSignIn=true and no notification email. Members are addressed by Entra
object ID where the membership carries one (covers accounts without a mail
attribute), else by email; the sender and members with neither are skipped,
and duplicates collapse. The grant is best-effort: if it fails the upload and
message still go through and a warning on stderr says to share the file from
OneDrive by hand. Channel attachments are unchanged — they live in the team's
SharePoint library, which channel members already read.

`AttachDestination::Chat` now carries the chat id so the media layer can look
the members up. New: `endpoints::me_drive_item_invite`, `DriveInviteRequest`
/ `DriveRecipient` / `DrivePermission` models, `files::grant_read_access`.
Unit tests cover recipient selection and the invite request's JSON shape;
docs and CHANGELOG updated.

Verified live in a four-member meeting chat: the debug log reports the file
shared with 3 members and Graph lists a read permission for each.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant