为 Power Apps 代码应用添加 Copilot Studio 连接器,便于调用智能体与集成回复。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "add-mcscopilot" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/power-platform-skills/main/plugins/code-apps/skills/add-mcscopilot/SKILL.md 2. 保存为 ~/.claude/skills/add-mcscopilot/SKILL.md 3. 装好后重载技能,告诉我可以用了
请为我的 Power Apps 代码应用添加 Microsoft Copilot Studio 连接器,并提供示例代码,用于向名为 SupportAgent 的智能体发送用户问题并显示回复。
包含连接器接入步骤、配置说明,以及调用智能体并渲染回复的示例代码。
帮我在 Power Apps 代码应用中接入 Copilot Studio 连接器,根据表单输入动态拼接提示词,发送给 SalesAgent,并返回结构化结果。
生成可复用的调用逻辑,支持动态提示词构造、请求发送与结构化响应处理。
请添加 Copilot Studio 连接器,并示范如何在 Power Apps 代码应用中处理智能体返回的成功、空结果和错误状态。
提供连接器集成方案,以及覆盖常见响应状态的错误处理与界面反馈示例。
📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
Check for memory-bank.md per shared-instructions.md.
First, find the connection ID (see connector-reference.md):
Run the /list-connections skill. Find the Microsoft Copilot Studio connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from power.config.json or a prior step): https://make.powerapps.com/environments/<environment-id>/connections → + New connection → search for the connector → Create.
npx power-apps add-data-source -a microsoftcopilotstudio -c <connection-id>
Ask the user which Copilot Studio agent they want to invoke and what operations they need.
(manual steps the user must complete in Copilot Studio):
https://...api.powerplatform.com/copilotstudio/dataverse-backed/authenticated/bots/cr3e1_myAgent/conversations?... — the agent name is cr3e1_myAgent.ExecuteCopilotAsyncV2 -- execute an agent and wait for the response:
Use the ExecuteCopilotAsyncV2 operation (path: /proactivecopilot/executeAsyncV2). This is the only endpoint that reliably returns agent responses synchronously. It is the same endpoint used by Power Automate's "Execute Agent and wait" action.
const result = await MicrosoftCopilotStudioService.ExecuteCopilotAsyncV2({
message: "Your prompt or data here", // Can be a JSON string
notificationUrl: "https://notificationurlplaceholder" // Required by API but unused; any URL works
});
// Response structure:
// result.responses — Array of response strings from the agent
// result.conversationId — The conversation ID
// result.lastResponse — The last response from the agent
// result.completed — Boolean indicating if the agent finished
Important: Agents often return responses as JSON strings. Parse the responses array to extract meaningful data:
const agentResponse = result.responses?.[0];
if (agentResponse) {
const parsed = JSON.parse(agentResponse);
// Extract specific fields, e.g., parsed.trend_summary
}
Use Grep to find specific methods in the generated service file (generated files can be very large — see connector-reference.md).
/execute) -- fire-and-forget, only returns ConversationId, not the actual response. Do NOT use this./executeAsync) -- returns 502 "Cannot read server response" errors. Do NOT use this./conversations/{ConversationId}) -- only works after /execute, which doesn't provide responses. Do NOT use this.conversationId, ConversationId, conversationID.npm run build
Fix TypeScript errors before proceeding. Do NOT deploy yet.
Update memory-bank.md with: connector added, agent name configured, configured operations, build status.
为 Power Apps 代码应用接入 Azure DevOps 连接器,便于查询工单、提报缺陷与管理流水线。
为 Power Apps 代码应用接入 SharePoint,支持列表、文档与站点集成