Skip to main content

Overview

Enable your agents to create, read, and manage Word documents and text files in OneDrive or SharePoint. Automate document creation, retrieve content, manage document properties, and streamline your document workflows with AI-powered automation.

Prerequisites

Before using the Microsoft Word integration, ensure you have:
  • A CrewAI AMP account with an active subscription
  • A Microsoft account with Word and OneDrive/SharePoint access
  • Connected your Microsoft account through the Integrations page

Setting Up Microsoft Word Integration

1. Connect Your Microsoft Account

  1. Navigate to CrewAI AMP Integrations
  2. Find Microsoft Word in the Authentication Integrations section
  3. Click Connect and complete the OAuth flow
  4. Grant the necessary permissions for file access
  5. Copy your Enterprise Token from Integration Settings

2. Install Required Package

3. Environment Variable Setup

To use integrations with Agent(apps=[]), you must set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable with your Enterprise Token.
Or add it to your .env file:

Available Actions

Description: Get all Word documents from OneDrive or SharePoint.Parameters:
  • select (string, optional): Select specific properties to return.
  • filter (string, optional): Filter results using OData syntax.
  • expand (string, optional): Expand related resources inline.
  • top (integer, optional): Number of items to return (min 1, max 999).
  • orderby (string, optional): Order results by specified properties.
Description: Create a text document (.txt) with content. RECOMMENDED for programmatic content creation that needs to be readable and editable.Parameters:
  • file_name (string, required): Name of the text document (should end with .txt).
  • content (string, optional): Text content for the document. Default is “This is a new text document created via API.”
Description: Get the content of a document (works best with text files).Parameters:
  • file_id (string, required): The ID of the document.
Description: Get properties and metadata of a document.Parameters:
  • file_id (string, required): The ID of the document.
Description: Delete a document.Parameters:
  • file_id (string, required): The ID of the document to delete.
Description: Copy a document to a new location in OneDrive.Parameters:
  • file_id (string, required): The ID of the document to copy
  • name (string, optional): New name for the copied document
  • parent_id (string, optional): The ID of the destination folder (defaults to root)
Description: Move a document to a new location in OneDrive.Parameters:
  • file_id (string, required): The ID of the document to move
  • parent_id (string, required): The ID of the destination folder
  • name (string, optional): New name for the moved document

Usage Examples

Basic Microsoft Word Agent Setup

Reading and Managing Documents

Document Cleanup and Organization

Troubleshooting

Common Issues

Authentication Errors
  • Ensure your Microsoft account has the necessary permissions for file access (e.g., Files.Read.All, Files.ReadWrite.All).
  • Verify that the OAuth connection includes all required scopes.
File Creation Issues
  • When creating text documents, ensure the file_name ends with .txt extension.
  • Verify that you have write permissions to the target location (OneDrive/SharePoint).
Document Access Issues
  • Double-check document IDs for correctness when accessing specific documents.
  • Ensure the referenced documents exist and are accessible.
  • Note that this integration works best with text files (.txt) for content operations.
Content Retrieval Limitations
  • The get_document_content action works best with text files (.txt).
  • For complex Word documents (.docx), consider using the document properties action to get metadata.

Getting Help

Need Help?

Contact our support team for assistance with Microsoft Word integration setup or troubleshooting.