Skip to content

feat: add shared_file_urls helper to extract SharePoint links from HTML attachments#498

Open
dcaayushd wants to merge 6 commits into
microsoft:mainfrom
dcaayushd:feat/message-activity-shared-file-urls
Open

feat: add shared_file_urls helper to extract SharePoint links from HTML attachments#498
dcaayushd wants to merge 6 commits into
microsoft:mainfrom
dcaayushd:feat/message-activity-shared-file-urls

Conversation

@dcaayushd

Copy link
Copy Markdown
Contributor

Related to #487

when a user shares a file via the Teams compose box, Teams embeds the
file link in a text/html attachment rather than sending structured file
metadata. the activity payload has no file info, just HTML content.

added a shared_file_urls property on MessageActivity that parses
SharePoint/OneDrive URLs from text/html attachments as a practical
workaround for this Teams platform behavior.

added two tests: one confirming URL extraction works, one confirming
empty list returned when no HTML attachments present.

Copilot AI review requested due to automatic review settings July 8, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a MessageActivity.shared_file_urls convenience property to extract SharePoint file links from text/html attachments, addressing a Teams platform behavior where shared cloud files appear only as embedded HTML rather than structured attachment metadata.

Changes:

  • Introduced shared_file_urls property on MessageActivity to parse URLs from HTML attachments.
  • Added unit tests validating URL extraction and the empty-list behavior when no HTML attachments exist.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/api/src/microsoft_teams/api/activities/message/message.py Adds shared_file_urls helper to extract SharePoint links from text/html attachment content.
packages/api/tests/unit/test_message_activities.py Adds unit tests for the new URL extraction property.

Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/tests/unit/test_message_activities.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
Comment thread packages/api/src/microsoft_teams/api/activities/message/message.py Outdated
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.

3 participants