---
name: teams-photo-export
description: Export photos and inline images from Microsoft Teams chats or channel threads into dated local folders. Use when the user shares a Teams chat URL, channel/thread URL, Teams title, or asks to save/download/extract Teams photos/images. Triggers on "Teams photos", "Teams images", "Teams画像保存", "Teams写真抽出", "チャット画像", "Teams URLから画像".
argument-hint: "Teams URL or title; optional output root/date range"
user-invocable: true
disable-model-invocation: true
license: CC BY-NC-SA 4.0
metadata:
  author: aktsmm
title: teams-photo-export
canonical_url: https://skilld.dev/gh/aktsmm/agent-skills/teams-photo-export
last_updated: 2026-10-29T04:01:24.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [LICENSE.txt](https://skilld.dev/api/skills-raw/aktsmm/agent-skills/teams-photo-export/LICENSE.txt), [references/implementation-notes.md](https://skilld.dev/api/skills-raw/aktsmm/agent-skills/teams-photo-export/references/implementation-notes.md), [scripts/export_visible_teams_images.py](https://skilld.dev/api/skills-raw/aktsmm/agent-skills/teams-photo-export/scripts/export_visible_teams_images.py), [skill-license.json](https://skilld.dev/api/skills-raw/aktsmm/agent-skills/teams-photo-export/skill-license.json).
>
> If the user asked to install this Skill, run `npx skilld install aktsmm/agent-skills/teams-photo-export`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/teams-photo-export`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/aktsmm/agent-skills/teams-photo-export) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/teams-photo-export`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/teams-photo-export --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/teams-photo-export --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Teams Photo Export

Extract images from Microsoft Teams conversations into organized local folders.

## When to Use

- User provides a Teams chat URL, channel/thread URL, or chat title and wants images/photos saved.
- User asks to export, extract, download, collect, or organize Teams photos/images.
- User wants the output under the configured work-photo folder.
- Manual invocation only (`/teams-photo-export`); the skill reads private chat content, so it is never started implicitly.

## Default Output Root

Resolve the output root in this order: `--output-root`, the user environment variable `TEAMS_IMAGE_EXPORT_ROOT`, then `<user pictures folder>\Teams Photo Export`. Ask the user when the destination matters (for example a cloud-synced work-photo folder), and set `TEAMS_IMAGE_EXPORT_ROOT` only with their agreement.

Output folders should be named:

```text
YYYY-MM-DD_<Teams chat/thread/project title>
```

Sanitize Windows-invalid characters: `\ / : * ? " < > |`.

## Strategy

Prefer the no-admin path first.

1. **Teams Web CDP path (default)**: open Teams Web in a dedicated Edge profile, attach Playwright over CDP, scroll the conversation, and save visible `img[alt="メディア"]` / `img[alt="Media"]` blob images.
2. **ASM full-size enhancement (not implemented in the script)**: capturing `asm.skype.com/.../views/imgpsh_fullsize*` responses would give originals instead of preview blobs; today the script saves the rendered blob images only.
3. **Graph hostedContents path (only if consent works)**: use `Chat.Read` or `ChannelMessage.Read.All` and `hostedContents/$value` for original-quality download.
4. **SPO/OneDrive attachment path**: use when `attachments[].contentUrl` points to a file in SharePoint/OneDrive. Inline pasted images usually are not stored there.

Do not rely on native Teams UI Automation as the main path; it is slower and less stable than Teams Web CDP.

## Workflow

1. Parse the input.
   - Chat URL example: extract `19:...@thread.v2` as `chatId`.
   - Channel URLs may need Teams Web navigation; do not assume Graph channel IDs are available.
   - If title search returns multiple candidates, ask the user to choose.
2. Create a dry-run plan.
   - Source URL/title
   - Output root and final folder
   - Date range or scroll limit
   - Expected naming pattern
3. Ask for confirmation before a large export.
4. Run `scripts/export_visible_teams_images.py` for the Teams Web path.
5. Verify saved file count and list the output folder.

## Script Usage

Start or reuse an Edge instance with CDP:

```powershell
python "%USERPROFILE%\.copilot\skills\teams-photo-export\scripts\export_visible_teams_images.py" `
  --url "https://teams.microsoft.com/l/chat/..." `
  --title "Project or chat title" `
  --date "2026-07-02"
```

Useful options:

```text
--output-root <path>     Override TEAMS_IMAGE_EXPORT_ROOT
--max-scrolls <n>        Limit virtual-scroll attempts
--dry-run                Show target folder and detected images without writing
--keep-browser-open      Do not close the dedicated Edge
```

## Safety Rules

- Only export content the signed-in user can access.
- Never send, forward, or share exported images automatically.
- Keep outbound summaries generic; images and chat metadata are private user data.
- Do not log bearer tokens or authenticated Graph URLs.
- Prefer a dedicated Edge user-data-dir so regular browser sessions are not disturbed.
- Do not overwrite existing files; use hashes to skip duplicates and sequence numbers for new files.

## References

- See `references/implementation-notes.md` for Graph/SPO/WebView2 tradeoffs and source URLs.
