Skip to content
cccskills
FreePublished on GitHub

sharepoint

AAD アプリ登録を行わずに、Microsoft Graph API 経由で SharePoint を包括的に操作する。リスト(ドキュメントライブラリ)・列・リスト項目の作成、ファイルアップロード、ページ作成、M365 グループ経由のサイト作成に対応。

Microsoft Graph PowerShell の well-known パブリッククライアントで委任認証し、auth_helper.py のキャッシュを再利用する。

The English summary is being prepared. Showing the original description.

Works withSharePoint
See how to install

Files included (10)

  • SKILL.md9.8 KB
  • references/.env.example326 B
  • references/sample-columns.json870 B
  • references/troubleshooting.md10.2 KB
  • scripts/_graph_common.py2.1 KB
  • scripts/create_list_item.py2.2 KB
  • scripts/create_list.py5.1 KB
  • scripts/create_page.py3.0 KB
  • scripts/create_site.py3.8 KB
  • scripts/upload_file.py2.7 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

SharePoint スキル(Graph API・AAD アプリ登録不要)

Microsoft Graph API で SharePoint を操作する。新規の Entra アプリ登録を行わない。 組織によっては 一般ユーザーにアプリ登録権限が無いことが多く、そのハードルを避けるため、Microsoft 製の well-known パブリッククライアント(Microsoft Graph PowerShell)への委任同意だけで完結させる。

Code Apps から呼ばれたときの境界

SharePoint URL だけでは直接接続の指示と解釈しない。 明示的な直接接続・継続利用の指定がなければ、URL は仕様・移行元の参照情報であり、 業務データを Dataverse に移行して Code Apps を開発する。 このスキルのトリガーに URL が一致しても、SharePoint リストの新規作成や書き込み、 shared_sharepointonline の追加を自動実行しない。 既存データの移行は dataverse と data-migration に渡す。 移行元の取得には依頼者の読み取り権限・対象範囲の確認が必要で、URL の受領だけを操作承認としない。 SharePoint 自体の作成・編集を明示依頼された場合は、以下の手順を使う。

対応する操作

操作スクリプトGraph API
リスト(ドキュメントライブラリ)・列の作成scripts/create_list.pyPOST /sites/{id}/lists, POST /sites/{id}/lists/{id}/columns
リスト項目(行)の登録scripts/create_list_item.pyPOST /sites/{id}/lists/{id}/items
ファイルアップロード(≤250MB)scripts/upload_file.pyPUT /sites/{id}/drive/root:/{path}:/content
サイトページの作成・公開scripts/create_page.pyPOST /sites/{id}/pages, POST .../pages/{id}/microsoft.graph.sitePage/publish
サイト作成(M365 グループ連携チームサイト・間接)scripts/create_site.pyPOST /groups → GET /groups/{id}/sites/root

サイトの更新・削除、グループ非連携のコミュニケーションサイト作成は Graph v1.0 に汎用 API が無く未対応。 詳細・回避策は references/troubleshooting.md を参照。

前提

  • standard スキル の auth_helper.py が使えること(.env に TENANT_ID 設定済み)
  • 対象 SharePoint サイトの URL(例: https://{tenant}.sharepoint.com/sites/{site})
  • 書き込み権限を持つアカウントでサインインできること(Sites.ReadWrite.All 等の委任スコープは Admin 同意が必要な場合がある。管理者アカウントでの初回同意を推奨)

なぜ既定の認証クライアントでは失敗するか

auth_helper.py の既定クライアント(Azure CLI 互換)には SharePoint 書き込み系スコープ (Sites.ReadWrite.All 等)が事前同意されていないため、書き込み系操作(POST/PUT)が 403 Forbidden になる(読み取り専用の GET は通ることが多く紛らわしい)。

新しい Entra アプリを登録すれば権限を自由に設計できるが、組織によってはアプリ登録自体が 一般ユーザーに許可されていないことが多い。そこで、Microsoft が既に multi-tenant で 公開・運用している Microsoft Graph PowerShell のクライアント ID (14d82eec-204b-4c2f-b7e8-296a70dab67e、全スクリプトの既定値)を使う。これは対象テナントに 新規アプリを登録する必要がなく、初回のみそのクライアントへの委任スコープ同意(管理者同意が 必要な場合あり)を行うだけで済む。

Work IQ のような一部の Microsoft 製 API は、これでも AADSTS65002(第一者アプリ同士の 事前承認が必要)で拒否される。 これは認証方式の問題ではなく、API 提供元が個別に許可した 第一者クライアントしか受け付けない仕様のため、well-known クライアント ID を変えても解決しない。 SharePoint / Graph の一般的なリソースにはこの制限は無いため本スキルの方式が使える (詳細は references/troubleshooting.md 参照)。

手順

Step 1: リスト(ドキュメントライブラリ)と列を作成する

列を作りたい場合は Microsoft Graph columnDefinition 形式の JSON 配列を用意する(references/sample-columns.json 参照)。

列名を決める際の注意(重要): SharePoint の非表示システム列と displayName が衝突する名前 (Description / Version / Title / Name / Type 等)は使わない。衝突すると Graph が 内部名を Xxx0 のように自動リネームし、冪等性チェックが効かず実行のたびに重複作成される。 SkillDescription のように接頭辞/接尾辞を付けて回避する。URL を保存する列は hyperlinkOrPicture 型ではなく text 型を使う(後述の理由により hyperlinkOrPicture は本スキルの検証環境で 一貫して 400 になった)。

# 確認のみ
python .github/skills/sharepoint/scripts/create_list.py `
  --site-url "https://{tenant}.sharepoint.com/sites/{site}" --list-name "SkillCatalog" --columns "path/to/columns.json"

# 実際に作成
python .github/skills/sharepoint/scripts/create_list.py `
  --site-url "https://{tenant}.sharepoint.com/sites/{site}" --list-name "SkillCatalog" --columns "path/to/columns.json" --apply

既存のリスト・列はスキップするため再実行しても安全(冪等)。

Step 2: リストに項目を登録する

注意: create_list_item.py はドキュメントライブラリ(--template documentLibrary)には使えない (Graph が POST .../items を拒否する。実機で確認済み。references/troubleshooting.md #7 参照)。 表形式データを行として管理したい場合は create_list.py --template genericList で汎用リストを作成すること。

python .github/skills/sharepoint/scripts/create_list_item.py `
  --site-url "https://{tenant}.sharepoint.com/sites/{site}" --list-name "MyGenericList" `
  --fields "path/to/fields.json"

--fields は PowerShell の引用符ネストで壊れやすいため、JSON はファイルに書いて渡すことを推奨する (例: {"Title": "Widget", "Color": "Purple"})。列名は create_list.py で作成した内部名(name)を使う。

Step 3: ファイルをアップロードする

python .github/skills/sharepoint/scripts/upload_file.py `
  --site-url "https://{tenant}.sharepoint.com/sites/{site}" `
  --local-path "./skill-image.png" --remote-path "SkillCatalog/skill-image.png"

既定ドキュメントライブラリ(サイトの drive = 通常 "Documents")を起点にした相対パスを指定する。 250MB を超えるファイルは分割アップロードセッションが必要で本スキル未対応。

Step 4: ページを作成する

python .github/skills/sharepoint/scripts/create_page.py `
  --site-url "https://{tenant}.sharepoint.com/sites/{site}" `
  --page-name "skill-catalog.aspx" --title "スキルカタログ" --html "<p>紹介文</p>" --publish

--publish を付けると作成直後に公開する。

Step 5(間接的・制約あり): サイトを作成する

Graph v1.0 に「新規 SharePoint サイトを直接作成する」汎用 API は無い。M365 グループを作成し、 その副作用としてプロビジョニングされる連携チームサイトを取得する方式を使う。

# 確認のみ
python .github/skills/sharepoint/scripts/create_site.py --display-name "Skill Catalog" --mail-nickname skillcatalogpoc

# 実際に作成(テナントに新しい M365 グループが追加されるため実行前に必ずユーザーに確認する)
python .github/skills/sharepoint/scripts/create_site.py --display-name "Skill Catalog" --mail-nickname skillcatalogpoc --apply

サイト作成はテナントのディレクトリに新しい M365 グループを追加する操作。 他の操作(リスト・ ファイル・ページ)よりも影響範囲が大きいため、--apply 実行前に必ずユーザーに確認すること。

参照

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

admin

Free

Power Platform のテナント / 環境ガバナンスを確認・設定する。通常開発では事前チェックせず、環境チェックの明示依頼時または開発・デプロイ障害時だけ診断する。依頼者の現在有効な委任権限と対象範囲を確認し、権限内の最小診断・承認済み修復・限定リトライ、権限不足なら管理者への依頼へ分岐する。環境・DLP・ACP・環境グループ・テナント戦略の確認と dry-run 付き管理操作を提供する。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

Copilot Studio 新 UI の Agent flows / Workflows を構築・公開・検証する。Dataverse レコード作成/更新トリガーから既存の発行済み Copilot Studio v2 を Agent ノードで呼ぶ標準経路、Code Apps との非同期要求/結果連携、および手動 Start + inline Agent の API ライフサイクル検証を扱う。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

株主総会の想定問答を、IR 抜粋(決算短信・説明資料・招集通知など)を根拠に下書きし、利用者の確認後に Dataverse の想定問答テーブルへ「下書き」として登録するスキル。 Use when ユーザーが「配当について想定問答を作って」「この論点の想定問答を 3 件追加して」「招集通知から想定問答を作って」「想定問答を登録して」と依頼したとき。 Dataverse MCP コネクタ(describe / read_query / search_data / create_record / update_record)を使用する。削除・テーブル変更のツールは使わない。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

株主総会の想定問答を点検し、根拠の IR 抜粋に無い数値・存在しない根拠 ID・回答者や注意事項の抜け・趣旨の重複・下書きのまま残っているものを一覧にするスキル(書き込みはしない)。 Use when ユーザーが「想定問答を点検して」「根拠の無い数値が無いか確認して」「下書きの想定問答を一覧にして」と依頼したとき。 Dataverse MCP コネクタ(describe / read_query / search_data)を使用する。書き込み・削除のツールは使わない。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

株主総会の質疑応答のリハーサル台本(議長・株主・回答役員の読み上げ原稿)を、承認済みの想定問答から作り、Dataverse のリハーサル台本テーブルへ登録するスキル。 Use when ユーザーが「リハーサルの台本を作って」「QA-001〜QA-010 で読み上げ原稿を作って」「番号を言わない株主も入れた台本を作って」と依頼したとき。 Dataverse MCP コネクタ(describe / read_query / search_data / create_record / update_record)を使用する。削除・テーブル変更のツールは使わない。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

AI Builder の AI プロンプト(GPT Dynamic Prompt)を Dataverse API で作成し、Copilot Studio エージェントにツール(アクション)として追加する。Power Automate フローとの統合パターンも含む。

The English summary is being prepared. Showing the original description.

geekfujiwara/CodeAppsDevelopmentStandard74Updated Oct 19, 2026

See all skills by geekfujiwara

Report a problem with this skill