add-sharepoint

作者: microsoft

将SharePoint Online连接器添加到Power Apps代码应用中。用于读取列表、管理文档或与SharePoint网站集成。还可以创建…

npx skills add https://github.com/microsoft/power-platform-skills --skill add-sharepoint

📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.

References:

Add SharePoint

Two paths: existing lists (skip to Step 6) or new lists (full workflow).

Workflow

  1. Check Memory Bank → 2. Plan → 3. Setup Graph API Auth → 4. Review Existing Lists → 5. Create Lists → 6. Get Connection ID → 7. Discover Sites → 8. Discover Tables → 9. Add Connector (tables and/or actions) → 10. Configure → 11. Build → 12. Update Memory Bank

Step 1: Check Memory Bank

Check for memory-bank.md per shared-instructions.md.

Step 2: Plan

Ask the user:

  1. Which SharePoint list(s) do they need?
  2. Do the lists already exist on their site, or do they need to create new ones?

If lists already exist: Skip to Step 6.

If creating new lists:

  • Ask about the data they need and design an appropriate schema
  • Reuse existing lists when possible (don't duplicate)
  • Enter plan mode with EnterPlanMode, present the list designs with columns and types
  • Get approval with ExitPlanMode

Step 3: Setup Graph API Auth (if creating lists)

See api-authentication-reference.md for full details.

az account show   # Verify Azure CLI logged in

$api = Initialize-SharePointGraphApi -SiteUrl "https://<tenant>.sharepoint.com/sites/<site-name>"
$headers = $api.Headers
$siteId = $api.SiteId

Requires Sites.Manage.All permission.

Step 4: Review Existing Lists (if creating lists)

Always query existing lists first before creating:

$existingLists = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/sites/$siteId/lists?`$select=id,displayName,description,list&`$filter=list/hidden eq false" -Headers $headers

See list-management-reference.md for Find-SimilarLists, Compare-ListSchemas, and Get-ListSchema functions.

Present findings to user with AskUserQuestion:

  • Lists that can be reused (already exist with matching columns)
  • Lists that need extension (exist but missing columns)
  • Lists that must be created (no match found)

Step 5: Create Lists (if creating lists)

Get explicit confirmation before creating. Use safe functions from list-management-reference.md:

  • New-SharePointListIfNotExists
  • Add-SharePointColumnIfNotExists
  • Add-SharePointLookupColumn (for cross-list references)

Step 6: Get Connection ID

Discovering sites and lists (Steps 7–8) needs a SharePoint connection ID on every CLI version: pa connection list-datasets and list-tables don't find or create connections the way pa app add data-source does on CLI 1.3.0+ (see connector-reference.md).

  1. Run the /list-connections skill, filtered with --search sharepointonline.
  2. Exactly one SharePoint connection: use its connection ID. Several: ask the user which one to use.
  3. None: create one after asking the user.
    • CLI 1.3.0+: SharePoint supports single sign-on, so with the user's OK run:

      pa connection create --connector shared_sharepointonline --use-sso
      

      It creates the connection silently with the user's account and prints Connection ID: <id>.

    • Older CLIs, or if the user wants a different sign-in type: follow Create a connection with the user, then repeat step 1.

Step 7: Discover Sites

List available SharePoint sites the user has access to:

pa connection list-datasets --connector sharepointonline -c <connection-id>

Present the sites to the user and ask which one(s) they want to connect to. If the user already specified a site URL, confirm it appears in the list.

If pa connection list-datasets fails or returns no results:

  • Auth error: Run pa auth login (or power-apps login on power-apps-only projects), then retry.
  • Empty list: Confirm the connection ID is for a SharePoint Online connection and the user has access to at least one site. STOP if the list is empty after confirming.
  • Any other non-zero exit: Report the exact error output. STOP.

Step 8: Discover Tables

For each selected site, list the available lists and document libraries:

pa connection list-tables --connector sharepointonline -c <connection-id> -d '<site-url>'

If pa connection list-tables fails or returns no results:

  • Confirm the site URL from Step 7 is exact (copy from the output — do not retype).
  • If still empty, the user may not have access to that site's lists. Ask them to verify permissions in SharePoint.
  • Any other non-zero exit: Report the exact error output. STOP.

Present the tables to the user and ask which ones they want to add. Suggest tables that look relevant to their use case (based on memory bank context or the user's stated requirements). If lists were created in Step 5, they should appear here.

Step 9: Add Connector

SharePoint supports both tables and actions, so say which one you're adding. Pass the connection ID from Step 6, so the add doesn't need to look for a connection (on CLI 1.3.0+, also pass --non-interactive):

# Lists and libraries as tables: -c (connection ID), -d (site URL), and --table (list name)
pa app add data-source --connector sharepointonline -c <connection-id> -d '<site-url>' --table '<table-name>'

# Document library and file operations (CLI 1.2.0+): add the connector's actions
pa app add data-source --connector sharepointonline -c <connection-id> --as action

Run the table command for each list or library the user selected. The -d (dataset) is the SharePoint site URL from Step 7, --table is the list/library display name from Step 8. Add the actions only if the app needs file or folder operations; the CLI keeps them as a separate data source next to the tables.

Step 10: Configure

Read sharepoint-reference.md before writing any SharePoint code -- column encoding, choice fields, and lookups have critical gotchas.

What the CLI generates depends on how you added SharePoint in Step 9 (CLI 1.3.0):

Added withGenerated serviceHow you call it
--table '<list>'One service per list, named after it (for example ProjectMilestonesService), with <List>Read / <List>Write modelsgetAll(options?), get(id), create(record), update(id, changedFields), delete(id)
--as actionSharePointServiceThe connector's operations, with positional parameters: GetItems(dataset, table, ...), PostItem(dataset, table, item), ListRootFolder(dataset), ListFolder(dataset, id), GetFileContent(dataset, id), and more

These examples were verified against CLI 1.3.0. Grep src/generated/services/ to confirm the service name and each method's exact signature before using it, especially in projects created with an older CLI.

Common operations:

// Lists added as tables: one typed service per list
const result = await ProjectMilestonesService.getAll({ top: 50, orderBy: ["Title asc"] });
const milestones = result.data ?? [];
await ProjectMilestonesService.create({ Title: "New milestone" });
await ProjectMilestonesService.update(id, { Title: "Renamed milestone" });

// Connector actions (added with --as action) take positional parameters, for example
// PostItem(dataset, table, item): dataset is the full site URL, table is the list's display name.
const dataset = "https://contoso.sharepoint.com/sites/your-site";
const items = await SharePointService.GetItems(dataset, "Your List Name");
await SharePointService.PostItem(dataset, "Your List Name", { Title: "New Item", Status: "Active" });

// Files in document libraries
const root = await SharePointService.ListRootFolder(dataset);
const files = await SharePointService.ListFolder(dataset, "<folder-id>");
const content = await SharePointService.GetFileContent(dataset, "<file-id>");

Key points:

  • dataset (action calls) is always the full SharePoint site URL
  • table (action calls) and --table (Step 9) take the list's display name
  • List column names in the API may differ from display names (spaces become _x0020_, special chars encoded)
  • Document library operations use folder/file IDs or server-relative URLs
  • Choice columns use string values, not integer picklist codes (unlike Dataverse)

Use Grep to find specific methods in the generated services (generated files can be very large -- see connector-reference.md).

Step 11: Build

npm run build

Fix TypeScript errors before proceeding. Do NOT deploy yet.

Step 12: Update Memory Bank

Update memory-bank.md with: connector added, site URL, lists/libraries configured (or created), build status. Don't record the connection ID.

来自 microsoft 的更多技能

oss-growth
microsoft
OSS增长黑客角色
agent-framework-azure-ai-py
microsoft
使用Microsoft Agent Framework Python SDK(agent-framework-azure-ai)构建Azure AI Foundry代理。在创建使用AzureAIAgentsProvider的持久化代理、使用托管工具(代码解释器、文件搜索、网络搜索)、集成MCP服务器、管理对话线程或实现流式响应时使用。涵盖函数工具、结构化输出和多工具代理。
development
airunway-aks-setup
microsoft
在AKS上设置AI Runway——从裸集群到运行模型。涵盖集群验证、控制器安装、GPU评估、提供商设置和首次部署。适用场景:“设置AI Runway”、“接入AKS集群”、“安装AI Runway”、“airunway设置”、“将模型部署到AKS”、“在AKS上进行GPU推理”、“在AKS上配置KAITO”、“在AKS上运行LLM”、“在AKS上使用vLLM”、“在AKS上设置模型服务”、“AI Runway控制器”。
devops
appinsights-instrumentation
microsoft
使用Azure Application Insights对Web应用进行插桩的指南。提供遥测模式、SDK设置和配置参考。适用场景:如何对应用进行插桩、App Insights SDK、遥测模式、什么是App Insights、Application Insights指南、插桩示例、APM最佳实践。
devops
applicationinsights-web-ts
microsoft
使用Application Insights JavaScript SDK(@microsoft/applicationinsights-web)为浏览器/Web应用添加检测。用于真实用户监控(RUM)——页面视图、点击、AJAX/fetch依赖项、异常、自定义事件,以及与后端OpenTelemetry追踪关联的浏览器端GenAI代理追踪。涵盖SDK加载器脚本和npm设置、框架扩展(React、React Native、Angular)、点击分析、遥测初始化器,以及从浏览器发出的代理/工具/模型跨度所遵循的OTel GenAI语义约定。
devops
azure-ai-anomalydetector-java
microsoft
使用适用于 Java 的 Azure AI 异常检测器 SDK 构建异常检测应用程序。在实现单变量/多变量异常检测、时间序列分析或 AI 驱动的监控时使用。
development
azure-ai-language-conversations-py
microsoft
使用azure-ai-language-conversations Python SDK实现对话语言理解(CLU)。当使用ConversationAnalysisClient分析对话意图和实体、构建NLP功能或将语言理解集成到应用程序中时使用。
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 for Python。用于机器学习工作区、作业、模型、数据集、计算资源和管道。 触发词:“azure-ai-ml”、“MLClient”、“工作区”、“模型注册表”、“训练作业”、“数据集”。
development