---
title: Microsoft SharePoint Integration
description: "Site, list, and document management with Microsoft SharePoint integration for CrewAI."
icon: "folder-tree"
mode: "wide"
---

## Overview

Enable your agents to access and manage SharePoint sites, lists, and document libraries. Retrieve site information, manage list items, upload and organize files, and streamline your SharePoint workflows with AI-powered automation.

## Prerequisites

Before using the Microsoft SharePoint integration, ensure you have:

- A [CrewAI AMP](https://app.crewai.com) account with an active subscription
- A Microsoft 365 account with SharePoint access
- Connected your Microsoft account through the [Integrations page](https://app.crewai.com/crewai_plus/connectors)

## Setting Up Microsoft SharePoint Integration

### 1. Connect Your Microsoft Account

1. Navigate to [CrewAI AMP Integrations](https://app.crewai.com/crewai_plus/connectors)
2. Find **Microsoft SharePoint** in the Authentication Integrations section
3. Click **Connect** and complete the OAuth flow
4. Grant the necessary permissions for SharePoint sites and content access
5. Copy your Enterprise Token from [Integration Settings](https://app.crewai.com/crewai_plus/settings/integrations)

### 2. Install Required Package

```bash
uv add crewai-tools
```

### 3. Environment Variable Setup

<Note>
  To use integrations with `Agent(apps=[])`, you must set the
  `CREWAI_PLATFORM_INTEGRATION_TOKEN` environment variable with your Enterprise
  Token.
</Note>

```bash
export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"
```

Or add it to your `.env` file:

```
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_token
```

## Available Actions

<AccordionGroup>
  <Accordion title="microsoft_sharepoint/get_sites">
    **Description:** Get all SharePoint sites the user has access to.

    **Parameters:**
    - `search` (string, optional): Search query to filter sites
    - `select` (string, optional): Select specific properties to return (e.g., 'displayName,id,webUrl')
    - `filter` (string, optional): Filter results using OData syntax
    - `expand` (string, optional): Expand related resources inline
    - `top` (integer, optional): Number of items to return. Minimum: 1, Maximum: 999
    - `skip` (integer, optional): Number of items to skip. Minimum: 0
    - `orderby` (string, optional): Order results by specified properties (e.g., 'displayName desc')

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_site">
    **Description:** Get information about a specific SharePoint site.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `select` (string, optional): Select specific properties to return (e.g., 'displayName,id,webUrl,drives')
    - `expand` (string, optional): Expand related resources inline (e.g., 'drives,lists')

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_drives">
    **Description:** List all document libraries (drives) in a SharePoint site. Use this to discover available libraries before using file operations.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `top` (integer, optional): Maximum number of drives to return per page (1-999). Default is 100
    - `skip_token` (string, optional): Pagination token from a previous response to fetch the next page of results
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'id,name,webUrl,driveType')

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_site_lists">
    **Description:** Get all lists in a SharePoint site.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_list">
    **Description:** Get information about a specific list.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `list_id` (string, required): The ID of the list

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_list_items">
    **Description:** Get items from a SharePoint list.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `list_id` (string, required): The ID of the list
    - `expand` (string, optional): Expand related data (e.g., 'fields')

  </Accordion>

  <Accordion title="microsoft_sharepoint/create_list_item">
    **Description:** Create a new item in a SharePoint list.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `list_id` (string, required): The ID of the list
    - `fields` (object, required): The field values for the new item
      ```json
      {
        "Title": "New Item Title",
        "Description": "Item description",
        "Status": "Active"
      }
      ```

  </Accordion>

  <Accordion title="microsoft_sharepoint/update_list_item">
    **Description:** Update an item in a SharePoint list.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `list_id` (string, required): The ID of the list
    - `item_id` (string, required): The ID of the item to update
    - `fields` (object, required): The field values to update
      ```json
      {
        "Title": "Updated Title",
        "Status": "Completed"
      }
      ```

  </Accordion>

  <Accordion title="microsoft_sharepoint/delete_list_item">
    **Description:** Delete an item from a SharePoint list.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `list_id` (string, required): The ID of the list
    - `item_id` (string, required): The ID of the item to delete

  </Accordion>

  <Accordion title="microsoft_sharepoint/upload_file_to_library">
    **Description:** Upload a file to a SharePoint document library.

    **Parameters:**
    - `site_id` (string, required): The ID of the SharePoint site
    - `file_path` (string, required): The path where to upload the file (e.g., 'folder/filename.txt')
    - `content` (string, required): The file content to upload

  </Accordion>

  <Accordion title="microsoft_sharepoint/list_files">
    **Description:** Retrieve files and folders from a SharePoint document library. By default lists the root folder, but you can navigate into subfolders by providing a folder_id.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `folder_id` (string, optional): The ID of the folder to list contents from. Use 'root' for the root folder, or provide a folder ID from a previous list_files call. Default is 'root'
    - `top` (integer, optional): Maximum number of items to return per page (1-1000). Default is 50
    - `skip_token` (string, optional): Pagination token from a previous response to fetch the next page of results
    - `orderby` (string, optional): Sort order for results (e.g., 'name asc', 'size desc', 'lastModifiedDateTime desc'). Default is 'name asc'
    - `filter` (string, optional): OData filter to narrow results (e.g., 'file ne null' for files only, 'folder ne null' for folders only)
    - `select` (string, optional): Comma-separated list of fields to return (e.g., 'id,name,size,folder,file,webUrl,lastModifiedDateTime')

  </Accordion>

  <Accordion title="microsoft_sharepoint/delete_file">
    **Description:** Delete a file or folder from a SharePoint document library. For folders, all contents are deleted recursively. Items are moved to the site recycle bin.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the file or folder to delete. Obtain from list_files

  </Accordion>

  <Accordion title="microsoft_sharepoint/list_files_by_path">
    **Description:** List files and folders in a SharePoint document library folder by its path. More efficient than multiple list_files calls for deep navigation.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `folder_path` (string, required): The full path to the folder without leading/trailing slashes (e.g., 'Documents', 'Reports/2024/Q1')
    - `top` (integer, optional): Maximum number of items to return per page (1-1000). Default is 50
    - `skip_token` (string, optional): Pagination token from a previous response to fetch the next page of results
    - `orderby` (string, optional): Sort order for results (e.g., 'name asc', 'size desc'). Default is 'name asc'
    - `select` (string, optional): Comma-separated list of fields to return (e.g., 'id,name,size,folder,file,webUrl,lastModifiedDateTime')

  </Accordion>

  <Accordion title="microsoft_sharepoint/download_file">
    **Description:** Download raw file content from a SharePoint document library. Use only for plain text files (.txt, .csv, .json). For Excel files, use the Excel-specific actions. For Word files, use get_word_document_content.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the file to download. Obtain from list_files or list_files_by_path

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_file_info">
    **Description:** Retrieve detailed metadata for a specific file or folder in a SharePoint document library, including name, size, created/modified dates, and author information.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the file or folder. Obtain from list_files or list_files_by_path
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'id,name,size,createdDateTime,lastModifiedDateTime,webUrl,createdBy,lastModifiedBy')

  </Accordion>

  <Accordion title="microsoft_sharepoint/create_folder">
    **Description:** Create a new folder in a SharePoint document library. By default creates the folder in the root; use parent_id to create subfolders.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `folder_name` (string, required): Name for the new folder. Cannot contain: \ / : * ? " < > |
    - `parent_id` (string, optional): The ID of the parent folder. Use 'root' for the document library root, or provide a folder ID from list_files. Default is 'root'

  </Accordion>

  <Accordion title="microsoft_sharepoint/search_files">
    **Description:** Search for files and folders in a SharePoint document library by keywords. Searches file names, folder names, and file contents for Office documents. Do not use wildcards or special characters.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `query` (string, required): Search keywords (e.g., 'report', 'budget 2024'). Wildcards like *.txt are not supported
    - `top` (integer, optional): Maximum number of results to return per page (1-1000). Default is 50
    - `skip_token` (string, optional): Pagination token from a previous response to fetch the next page of results
    - `select` (string, optional): Comma-separated list of fields to return (e.g., 'id,name,size,folder,file,webUrl,lastModifiedDateTime')

  </Accordion>

  <Accordion title="microsoft_sharepoint/copy_file">
    **Description:** Copy a file or folder to a new location within SharePoint. The original item remains unchanged. The copy operation is asynchronous for large files.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the file or folder to copy. Obtain from list_files or search_files
    - `destination_folder_id` (string, required): The ID of the destination folder. Use 'root' for the root folder, or a folder ID from list_files
    - `new_name` (string, optional): New name for the copy. If not provided, the original name is used

  </Accordion>

  <Accordion title="microsoft_sharepoint/move_file">
    **Description:** Move a file or folder to a new location within SharePoint. The item is removed from its original location. For folders, all contents are moved as well.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the file or folder to move. Obtain from list_files or search_files
    - `destination_folder_id` (string, required): The ID of the destination folder. Use 'root' for the root folder, or a folder ID from list_files
    - `new_name` (string, optional): New name for the moved item. If not provided, the original name is kept

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_worksheets">
    **Description:** List all worksheets (tabs) in an Excel workbook stored in a SharePoint document library. Use the returned worksheet name with other Excel actions.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'id,name,position,visibility')
    - `filter` (string, optional): OData filter expression (e.g., "visibility eq 'Visible'" to exclude hidden sheets)
    - `top` (integer, optional): Maximum number of worksheets to return. Minimum: 1, Maximum: 999
    - `orderby` (string, optional): Sort order (e.g., 'position asc' to return sheets in tab order)

  </Accordion>

  <Accordion title="microsoft_sharepoint/create_excel_worksheet">
    **Description:** Create a new worksheet (tab) in an Excel workbook stored in a SharePoint document library. The new sheet is added at the end of the tab list.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `name` (string, required): Name for the new worksheet. Maximum 31 characters. Cannot contain: \ / * ? : [ ]. Must be unique within the workbook

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_range_data">
    **Description:** Retrieve cell values from a specific range in an Excel worksheet stored in SharePoint. For reading all data without knowing dimensions, use get_excel_used_range instead.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet (tab) to read from. Obtain from get_excel_worksheets. Case-sensitive
    - `range` (string, required): Cell range in A1 notation (e.g., 'A1:C10', 'A:C', '1:5', 'A1')
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'address,values,formulas,numberFormat,text')

  </Accordion>

  <Accordion title="microsoft_sharepoint/update_excel_range_data">
    **Description:** Write values to a specific range in an Excel worksheet stored in SharePoint. Overwrites existing cell contents. The values array dimensions must match the range dimensions exactly.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet (tab) to update. Obtain from get_excel_worksheets. Case-sensitive
    - `range` (string, required): Cell range in A1 notation where values will be written (e.g., 'A1:C3' for a 3x3 block)
    - `values` (array, required): 2D array of values (rows containing cells). Example for A1:B2: [["Header1", "Header2"], ["Value1", "Value2"]]. Use null to clear a cell

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_used_range_metadata">
    **Description:** Return only the metadata (address and dimensions) of the used range in a worksheet, without the actual cell values. Ideal for large files to understand spreadsheet size before reading data in chunks.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet (tab) to read. Obtain from get_excel_worksheets. Case-sensitive

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_used_range">
    **Description:** Retrieve all cells containing data in a worksheet stored in SharePoint. Do not use for files larger than 2MB. For large files, use get_excel_used_range_metadata first, then get_excel_range_data to read in smaller chunks.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet (tab) to read. Obtain from get_excel_worksheets. Case-sensitive
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'address,values,formulas,numberFormat,text,rowCount,columnCount')

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_cell">
    **Description:** Retrieve the value of a single cell by row and column index from an Excel file in SharePoint. Indices are 0-based (row 0 = Excel row 1, column 0 = column A).

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet (tab). Obtain from get_excel_worksheets. Case-sensitive
    - `row` (integer, required): 0-based row index (row 0 = Excel row 1). Valid range: 0-1048575
    - `column` (integer, required): 0-based column index (column 0 = A, column 1 = B). Valid range: 0-16383
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'address,values,formulas,numberFormat,text')

  </Accordion>

  <Accordion title="microsoft_sharepoint/add_excel_table">
    **Description:** Convert a cell range into a formatted Excel table with filtering, sorting, and structured data capabilities. Tables enable add_excel_table_row for appending data.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet containing the data range. Obtain from get_excel_worksheets
    - `range` (string, required): Cell range to convert into a table, including headers and data (e.g., 'A1:D10' where A1:D1 contains column headers)
    - `has_headers` (boolean, optional): Set to true if the first row contains column headers. Default is true

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_tables">
    **Description:** List all tables in a specific Excel worksheet stored in SharePoint. Returns table properties including id, name, showHeaders, and showTotals.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet to get tables from. Obtain from get_excel_worksheets

  </Accordion>

  <Accordion title="microsoft_sharepoint/add_excel_table_row">
    **Description:** Append a new row to the end of an Excel table in a SharePoint file. The values array must have the same number of elements as the table has columns.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet containing the table. Obtain from get_excel_worksheets
    - `table_name` (string, required): Name of the table to add the row to (e.g., 'Table1'). Obtain from get_excel_tables. Case-sensitive
    - `values` (array, required): Array of cell values for the new row, one per column in table order (e.g., ["John Doe", "john@example.com", 25])

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_excel_table_data">
    **Description:** Get all rows from an Excel table in a SharePoint file as a data range. Easier than get_excel_range_data when working with structured tables since you don't need to know the exact range.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet containing the table. Obtain from get_excel_worksheets
    - `table_name` (string, required): Name of the table to get data from (e.g., 'Table1'). Obtain from get_excel_tables. Case-sensitive
    - `select` (string, optional): Comma-separated list of properties to return (e.g., 'address,values,formulas,numberFormat,text')

  </Accordion>

  <Accordion title="microsoft_sharepoint/create_excel_chart">
    **Description:** Create a chart visualization in an Excel worksheet stored in SharePoint from a data range. The chart is embedded in the worksheet.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet where the chart will be created. Obtain from get_excel_worksheets
    - `chart_type` (string, required): Chart type (e.g., 'ColumnClustered', 'ColumnStacked', 'Line', 'LineMarkers', 'Pie', 'Bar', 'BarClustered', 'Area', 'Scatter', 'Doughnut')
    - `source_data` (string, required): Data range for the chart in A1 notation, including headers (e.g., 'A1:B10')
    - `series_by` (string, optional): How data series are organized: 'Auto', 'Columns', or 'Rows'. Default is 'Auto'

  </Accordion>

  <Accordion title="microsoft_sharepoint/list_excel_charts">
    **Description:** List all charts embedded in an Excel worksheet stored in SharePoint. Returns chart properties including id, name, chartType, height, width, and position.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet to list charts from. Obtain from get_excel_worksheets

  </Accordion>

  <Accordion title="microsoft_sharepoint/delete_excel_worksheet">
    **Description:** Permanently remove a worksheet (tab) and all its contents from an Excel workbook stored in SharePoint. Cannot be undone. A workbook must have at least one worksheet.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet to delete. Case-sensitive. All data, tables, and charts on this sheet will be permanently removed

  </Accordion>

  <Accordion title="microsoft_sharepoint/delete_excel_table">
    **Description:** Remove a table from an Excel worksheet in SharePoint. This deletes the table structure (filtering, formatting, table features) but preserves the underlying cell data.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files
    - `worksheet_name` (string, required): Name of the worksheet containing the table. Obtain from get_excel_worksheets
    - `table_name` (string, required): Name of the table to delete (e.g., 'Table1'). Obtain from get_excel_tables. The data in the cells will remain after table deletion

  </Accordion>

  <Accordion title="microsoft_sharepoint/list_excel_names">
    **Description:** Retrieve all named ranges defined in an Excel workbook stored in SharePoint. Named ranges are user-defined labels for cell ranges (e.g., 'SalesData' for A1:D100).

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Excel file in SharePoint. Obtain from list_files or search_files

  </Accordion>

  <Accordion title="microsoft_sharepoint/get_word_document_content">
    **Description:** Download and extract text content from a Word document (.docx) stored in a SharePoint document library. This is the recommended way to read Word documents from SharePoint.

    **Parameters:**
    - `site_id` (string, required): The full SharePoint site identifier from get_sites
    - `drive_id` (string, required): The ID of the document library. Call get_drives first to get valid drive IDs
    - `item_id` (string, required): The unique identifier of the Word document (.docx) in SharePoint. Obtain from list_files or search_files

  </Accordion>
</AccordionGroup>

## Usage Examples

### Basic SharePoint Agent Setup

```python
from crewai import Agent, Task, Crew

# Create an agent with SharePoint capabilities
sharepoint_agent = Agent(
    role="SharePoint Manager",
    goal="Manage SharePoint sites, lists, and documents efficiently",
    backstory="An AI assistant specialized in SharePoint content management and collaboration.",
    apps=['microsoft_sharepoint']  # All SharePoint actions will be available
)

# Task to organize SharePoint content
content_organization_task = Task(
    description="List all accessible SharePoint sites and organize content by department",
    agent=sharepoint_agent,
    expected_output="SharePoint sites listed and content organized by department"
)

# Run the task
crew = Crew(
    agents=[sharepoint_agent],
    tasks=[content_organization_task]
)

crew.kickoff()
```

### List Management and Data Operations

```python
from crewai import Agent, Task, Crew

list_manager = Agent(
    role="List Manager",
    goal="Manage SharePoint lists and data efficiently",
    backstory="An AI assistant that focuses on SharePoint list management and data operations.",
    apps=[
        'microsoft_sharepoint/get_site_lists',
        'microsoft_sharepoint/get_list_items',
        'microsoft_sharepoint/create_list_item',
        'microsoft_sharepoint/update_list_item'
    ]
)

# Task to manage list data
list_management_task = Task(
    description="Get all lists from the project site, review items, and update status for completed tasks",
    agent=list_manager,
    expected_output="SharePoint lists reviewed and task statuses updated"
)

crew = Crew(
    agents=[list_manager],
    tasks=[list_management_task]
)

crew.kickoff()
```

### Document Library Management

```python
from crewai import Agent, Task, Crew

document_manager = Agent(
    role="Document Manager",
    goal="Manage SharePoint document libraries and files",
    backstory="An AI assistant that specializes in document organization and file management.",
    apps=['microsoft_sharepoint']
)

# Task to manage documents
document_task = Task(
    description="""
    1. Get all files from the main document library
    2. Upload new policy documents to the appropriate folders
    3. Organize files by department and date
    4. Remove outdated documents
    """,
    agent=document_manager,
    expected_output="Document library organized with new files uploaded and outdated files removed"
)

crew = Crew(
    agents=[document_manager],
    tasks=[document_task]
)

crew.kickoff()
```

### Site Administration and Analysis

```python
from crewai import Agent, Task, Crew

site_administrator = Agent(
    role="Site Administrator",
    goal="Administer and analyze SharePoint sites",
    backstory="An AI assistant that handles site administration and provides insights on site usage.",
    apps=['microsoft_sharepoint']
)

# Task for site administration
admin_task = Task(
    description="""
    1. Get information about all accessible SharePoint sites
    2. Analyze site structure and content organization
    3. Identify sites with low activity or outdated content
    4. Generate recommendations for site optimization
    """,
    agent=site_administrator,
    expected_output="Site analysis completed with optimization recommendations"
)

crew = Crew(
    agents=[site_administrator],
    tasks=[admin_task]
)

crew.kickoff()
```

### Automated Content Workflows

```python
from crewai import Agent, Task, Crew

workflow_automator = Agent(
    role="Workflow Automator",
    goal="Automate SharePoint content workflows and processes",
    backstory="An AI assistant that automates complex SharePoint workflows and content management processes.",
    apps=['microsoft_sharepoint']
)

# Complex workflow automation task
automation_task = Task(
    description="""
    1. Monitor project lists across multiple sites
    2. Create status reports based on list data
    3. Upload reports to designated document libraries
    4. Update project tracking lists with completion status
    5. Archive completed project documents
    6. Send notifications for overdue items
    """,
    agent=workflow_automator,
    expected_output="Automated workflow completed with status reports generated and project tracking updated"
)

crew = Crew(
    agents=[workflow_automator],
    tasks=[automation_task]
)

crew.kickoff()
```

### Data Integration and Reporting

```python
from crewai import Agent, Task, Crew

data_integrator = Agent(
    role="Data Integrator",
    goal="Integrate and analyze data across SharePoint sites and lists",
    backstory="An AI assistant that specializes in data integration and cross-site analysis.",
    apps=['microsoft_sharepoint']
)

# Task for data integration
integration_task = Task(
    description="""
    1. Get data from multiple SharePoint lists across different sites
    2. Consolidate information into comprehensive reports
    3. Create new list items with aggregated data
    4. Upload analytical reports to executive document library
    5. Update dashboard lists with key metrics
    """,
    agent=data_integrator,
    expected_output="Data integrated across sites with comprehensive reports and updated dashboards"
)

crew = Crew(
    agents=[data_integrator],
    tasks=[integration_task]
)

crew.kickoff()
```

## Troubleshooting

### Common Issues

**Permission Errors**

- Ensure your Microsoft account has appropriate permissions for SharePoint sites
- Verify that the OAuth connection includes required scopes (Sites.Read.All, Sites.ReadWrite.All)
- Check that you have access to the specific sites and lists you're trying to access

**Site and List ID Issues**

- Verify that site IDs and list IDs are correct and properly formatted
- Ensure that sites and lists exist and are accessible to your account
- Use the get_sites and get_site_lists actions to discover valid IDs

**Field and Schema Issues**

- Ensure field names match exactly with the SharePoint list schema
- Verify that required fields are included when creating or updating list items
- Check that field types and values are compatible with the list column definitions

**File Upload Issues**

- Ensure file paths are properly formatted and don't contain invalid characters
- Verify that you have write permissions to the target document library
- Check that file content is properly encoded for upload

**OData Query Issues**

- Use proper OData syntax for filter, select, expand, and orderby parameters
- Verify that property names used in queries exist in the target resources
- Test simple queries before building complex filter expressions

**Pagination and Performance**

- Use top and skip parameters appropriately for large result sets
- Implement proper pagination for lists with many items
- Consider using select parameters to return only needed properties

**Document Library Operations**

- Ensure you have proper permissions for document library operations
- Verify that drive item IDs are correct when deleting files or folders
- Check that file paths don't conflict with existing content

### Getting Help

<Card title="Need Help?" icon="headset" href="mailto:support@crewai.com">
  Contact our support team for assistance with Microsoft SharePoint integration
  setup or troubleshooting.
</Card>
