Skip to content

Commit 82a653b

Browse files
authored
Merge pull request #5114 from aahill/sharepoint-may
sharepoint docs
2 parents 5a9c67c + 1d47a3d commit 82a653b

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: 'How to use the SharePoint tool'
3+
titleSuffix: Azure AI Foundry
4+
description: Find examples on how to ground agents with SharePoint.
5+
services: cognitive-services
6+
manager: nitinme
7+
ms.service: azure-ai-agent-service
8+
ms.topic: how-to
9+
ms.date: 06/05/2025
10+
author: aahill
11+
ms.author: aahi
12+
ms.custom: azure-ai-agents-code
13+
zone_pivot_groups: selection-sharepoint
14+
---
15+
16+
# How to use the SharePoint tool
17+
18+
Use this article to find step-by-step instructions and code samples for using the SharePoint tool in Azure AI Foundry Agent Service.
19+
20+
## Create an agent
21+
22+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
23+
24+
```bash
25+
curl --request POST \
26+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
27+
-H "Authorization: Bearer $AGENT_TOKEN" \
28+
-H "Content-Type: application/json" \
29+
-d '{
30+
"instructions": "You are a helpful agent.",
31+
"name": "my-agent",
32+
"model": "gpt-4o",
33+
"tools": [
34+
{
35+
"type": "sharepoint_grounding",
36+
"sharepoint_grounding": {
37+
"connections": [
38+
{
39+
"connection_id": "/subscriptions/<sub-id>/resourceGroups/<your-rg-name>/providers/Microsoft.CognitiveServices/accounts/<your-ai-services-name>/projects/<your-project-name>/connections/<your-sharepoint-connection-name>"
40+
}
41+
]
42+
}
43+
}
44+
]
45+
}'
46+
```
47+
48+
## Create a thread
49+
50+
```bash
51+
curl --request POST \
52+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
53+
-H "Authorization: Bearer $AGENT_TOKEN" \
54+
-H "Content-Type: application/json" \
55+
-d ''
56+
```
57+
58+
### Add a user question to the thread
59+
60+
```bash
61+
curl --request POST \
62+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
63+
-H "Authorization: Bearer $AGENT_TOKEN" \
64+
-H "Content-Type: application/json" \
65+
-d '{
66+
"role": "user",
67+
"content": "What is the weather in Seattle?"
68+
}'
69+
```
70+
71+
## Run the thread
72+
73+
```bash
74+
curl --request POST \
75+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
76+
-H "Authorization: Bearer $AGENT_TOKEN" \
77+
-H "Content-Type: application/json" \
78+
-d '{
79+
"assistant_id": "asst_abc123",
80+
}'
81+
```
82+
83+
## Retrieve the status of the run
84+
85+
```bash
86+
curl --request GET \
87+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
88+
-H "Authorization: Bearer $AGENT_TOKEN"
89+
```
90+
91+
## Retrieve the agent response
92+
93+
```bash
94+
curl --request GET \
95+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
96+
-H "Authorization: Bearer $AGENT_TOKEN"
97+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: 'How to use Microsoft SharePoint content with Azure AI Agent Service'
3+
titleSuffix: Azure OpenAI
4+
description: Learn how to ground Azure AI Agents using Microsoft SharePoint content.
5+
services: cognitive-services
6+
manager: nitinme
7+
ms.service: azure-ai-agent-service
8+
ms.topic: how-to
9+
ms.date: 06/05/2025
10+
author: aahill
11+
ms.author: aahi
12+
ms.custom: azure-ai-agents
13+
---
14+
# Use the Microsoft SharePoint tool (preview)
15+
16+
Integrate your agents with the **Microsoft SharePoint** to chat with your private documents securely. You can connect to your SharePoint site, such as `contoso.sharepoint.com/sites/policies` to ground your Agents with that data. When a user sends a query, the agent will determine if SharePoint should be leveraged or not. If so, it will send a query using the SharePoint tool, which checks if the user has a Microsoft 365 Copilot license and use managed identity to retrieve relevant documents they have access to. The scope of retrieval includes all supported documents in this SharePoint site. Lastly, the agent will generate responses based on retrieved information. With identity passthrough (On-Behalf-Of) authorization, this integration simplifies access to enterprise data in SharePoint while maintaining robust security, ensuring proper access control and enterprise-grade protection.
17+
18+
## Usage support
19+
20+
|Azure AI foundry support | Python SDK | C# SDK | JavaScript SDK | REST API |Basic agent setup | Standard agent setup |
21+
|---------|---------|---------|---------|---------|---------|---------|
22+
| ✔️ | - | - | - | ✔️ | ✔️ | ✔️ |
23+
24+
## Prerequisites
25+
26+
* Developers and end users have Microsoft 365 Copilot license.
27+
* Developers and end users have at least `Azure AI User` RBAC role.
28+
* Developers and end users have at least `READ` access to the SharePoint site.
29+
30+
## Setup
31+
32+
> [!NOTE]
33+
> * Supported document types: text data in the following format: `.pdf`, `.docx`, `.ppt`, `.txt`, `.aspx`
34+
> * We recommend you start with SharePoint sites that have: a simple folder structure and a small number of short documents.
35+
36+
1. Create an agent by following the steps in the [quickstart](../../quickstart.md).
37+
38+
1. You can add the SharePoint tool to an agent programatically using the code examples listed at the top of this article, or the Azure AI Foundry portal. If you want to use the portal, in either the **Create and debug** or **Agent playground** screen for your agent, scroll down the setup pane on the right to knowledge. Then select **Add**.
39+
40+
:::image type="content" source="../../media/tools/knowledge-tools.png" alt-text="A screenshot showing the available tool categories in the Azure AI Foundry portal." lightbox="../../media/tools/knowledge-tools.png":::
41+
42+
1. Select **SharePoint** and follow the prompts to add the tool. You can only add one per agent.
43+
44+
1. Click to add a new connection. Once you have added a connection, you can directly select from existing list.
45+
1. To create a new connection, you need to find `site_url` in your SharePoint site. You can add either a SharePoint site or a SharePoint folder. For a SharePoint site, it will look like `https://microsoft.sharepoint.com/teams/<site_name>`. For a SharePoint folder, it will look like `https://microsoft.sharepoint.com/teams/<site_name>/Shared%20documents/<folder_name>`
46+
47+
1. Then, you can add it to your connection. Make sure you have selected the **is secret** option.
48+
49+
## Next steps
50+
51+
[See the full sample for SharePoint.](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_sharepoint.py)

articles/ai-services/agents/toc.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ items:
9393
displayName: azure functions, functions
9494
- name: How to use Azure Functions
9595
href: how-to/tools/azure-functions-samples.md
96+
- name: SharePoint
97+
items:
98+
- name: Overview
99+
href: how-to/tools/sharepoint.md
100+
displayName: sharepoint
101+
- name: How to use SharePoint
102+
href: how-to/tools/sharepoint-samples.md
96103
- name: Enterprise features
97104
items:
98105
- name: Use your own resources

0 commit comments

Comments
 (0)