Share chat attachments with the chat's members after upload - #93
Open
philipwilsonTHG wants to merge 1 commit into
Open
Share chat attachments with the chat's members after upload#93philipwilsonTHG wants to merge 1 commit into
philipwilsonTHG wants to merge 1 commit into
Conversation
`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>
philipwilsonTHG
force-pushed
the
chat-attach-share
branch
from
September 4, 2026 09:52
42f727e to
65df9f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
teams message send --chat … --attach FILEuploads 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
inviteaction (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::Chatcarries the chat id so the media layer can look the members up.endpoints::me_drive_item_invite,DriveInviteRequest/DriveRecipient/DrivePermissionmodels,files::grant_read_access.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