Note: The SharePoint integration feature described in this document is exclusively available in RLAMA Pro, our premium offering designed for teams and enterprises. This functionality is not included in the free community version of RLAMA.
Microsoft SharePoint is at the core of many organizations' document management strategy. This integration offers several advantages:
- Access to internal knowledge: Leverage years of internal documentation
- Up-to-date data: Always use the latest versions of documents
- Security: Respect your company's security policies
- Simplicity: No need to export or duplicate files
Setting Up SharePoint Integration
Prerequisites
- A SharePoint instance
- An Azure account with necessary permissions
rlama
installed on your machine
Step 1: Register an Application in Azure
Before using the integration, you need to create an application in Azure AD:
- Log in to the Azure Portal
- Navigate to "Azure Active Directory" → "App registrations" → "New registration"
- Name your application (e.g., "RLAMA SharePoint Integration")
- For the redirect URI, choose "Web" and enter a valid URL (can be changed later)
- Click "Register"
Step 2: Configure Permissions
Once the application is created:
- In your application, go to "API permissions"
- Add a permission → Microsoft Graph → Application permissions
- Search for and add:
Sites.Read.All
(to read all SharePoint sites)Files.Read.All
(to read all files)
- Click "Grant admin consent"
Step 3: Create a Client Secret
- Go to "Certificates & secrets"
- Under "Client secrets", click "New client secret"
- Provide a description and choose an expiration
- Important: Note down the secret value immediately, as it won't be visible again
Step 4: Configure rlama
Now, set up your SharePoint profile in rlama:
rlama sharepoint setup my-sharepoint \
--tenant-id "your-tenant-id" \
--client-id "your-client-id" \
--client-secret "your-client-secret" \
--site-url "https://yourcompany.sharepoint.com/sites/YourSite"
Verify that the connection works correctly:
rlama sharepoint test my-sharepoint "Documents"
This command should list the files in the "Documents" folder of your SharePoint site.
Creating a RAG with SharePoint Documents
Once your SharePoint profile is configured, you can create a RAG directly from your documents:
rlama rag llama3.3 my-sharepoint-rag \
--source=sharepoint \
--sp-profile=my-sharepoint \
--sp-folder="Documents/Projects/Specifications" \
--chunk-size=1000 \
--chunk-overlap=200
Important Parameters
--source=sharepoint
: Indicates to use SharePoint as the data source--sp-profile
: The name of the previously configured SharePoint profile--sp-folder
: The path to the folder in SharePoint containing your documents--chunk-size
: Size of text fragments (in characters)--chunk-overlap
: Overlap between fragments
Adding SharePoint Documents to an Existing RAG
One powerful feature of rlama
is the ability to add SharePoint documents to an existing RAG system, allowing you to mix documents from different sources:
rlama add-docs my-existing-rag \
--source=sharepoint \
--sp-profile=my-sharepoint \
--sp-folder="Documents/Research" \
--chunk-size=1000 \
--chunk-overlap=200
This capability provides several benefits:
- Hybrid knowledge bases: Combine internal SharePoint documents with local files or Snowflake data
- Incremental updates: Start with local documents and gradually add SharePoint resources
- Departmental RAGs: Create specialized RAGs by adding specific SharePoint folders to a common base
- Testing environments: Test with local files before adding production SharePoint documents
For example, you could create a RAG with local files for a project, then enrich it with corporate guidelines from SharePoint:
# First, create a RAG with local project files
rlama rag llama3.3 project-rag ./project-docs
# Then, add corporate guidelines from SharePoint
rlama add-docs project-rag \
--source=sharepoint \
--sp-profile=my-sharepoint \
--sp-folder="Documents/Corporate/Guidelines"
How the Integration Works
Under the hood, rlama
performs the following operations:
- Authentication: Secure connection to SharePoint via Microsoft Graph API
- File Retrieval: Lists and accesses files in the specified folder
- Text Extraction: Textual content is extracted from documents (including PDFs)
- Intelligent Chunking: The text is divided into chunks with overlap
- Embedding Generation: Each chunk is transformed into an embedding vector
- Storage: Chunks and their embeddings are stored in the vector database
Example RAG Usage
Once your RAG is created, you can query it like any other RAG:
rlama chat my-sharepoint-rag
> What is the status of Project Alpha according to our latest specifications?
The AI will search for relevant information in your SharePoint documents and generate a response based on this content.
Best Practices
To get the best results with SharePoint integration:
- Select the right folder: Choose a folder containing relevant and coherent documents
- Adjust chunk size: Experiment with different sizes to find the optimal balance
- Use adapted formats: Favor text, PDF, or Office formats for better extraction
- Limit initial volume: Start with a few hundred documents maximum
- Update regularly: Recreate or update your RAG periodically to integrate new versions
- Combine sources strategically: When mixing document sources, ensure they complement each other
Common Troubleshooting
Authentication Error
Check that the tenant ID, client ID, and client secret are correct. Also ensure that admin consents have been granted.
Inaccessible Files
Confirm that the application has sufficient permissions and that the folder path is correct.
PDF Processing Fails
Make sure pdftotext
is installed on your system for PDF text extraction.
Duplicate Content
When adding documents to an existing RAG, rlama
checks for duplicates by name. Rename files if you want to add updated versions.
Conclusion
Integrating SharePoint with rlama Pro
opens new possibilities for leveraging your enterprise documents. With just a few commands, transform years of institutional knowledge into an intelligent AI assistant that precisely answers your business questions.
The ability to mix document sources – SharePoint, local files, and databases – makes rlama Pro
an incredibly flexible tool for building comprehensive knowledge bases tailored to your specific needs.
Try RLAMA Pro today and discover how RAG can revolutionize access to information in your organization!
Do you have questions or need help with SharePoint integration? Join our GitHub community or check out the complete documentation. For information about upgrading to RLAMA Pro to access enterprise features like SharePoint integration, visit our pricing page.