Building and customizing solutions using Microsoft 365 Copilot APIs and tools
This is a known issue with M365 Copilot when using large SharePoint folder structures as knowledge sources. The intermittent behavior and repeated access to one folder suggest an indexing, caching, or retrieval issue. Here are solutions:
Root Causes
- Search Index Not Fully Updated – The SharePoint search index hasn't crawled all 1,900 subfolders
- Caching Issue – The agent is cached to reference a specific folder
- Permission Issues – Some subfolders lack the agent's read permissions
- Folder Depth Limit – Too many nested levels may exceed the agent's retrieval depth
- File Size/Type Issues – Some files in subfolders may be unsupported or too large
Solutions
- Re-Index the Knowledge Source: In M365 Copilot agent settings, go to Knowledge Sources. Remove the SharePoint folder from the knowledge source. Wait 5-10 minutes for the cache to clear. Re-add the SharePoint folder. Force a search index refresh in SharePoint Admin Center: SharePoint Admin Center → Settings → Search → Re-index
- Check Folder Permissions: Ensure the Copilot Agent Service Account has read access to ALL subfolders. Go to the top-level SharePoint folder → Share → Add the agent service account with "Read" or "View" permissions. Verify permissions are inherited down to all 1,900 subfolders. If any subfolder has unique permissions, ensure the agent is included
- Restructure the Folder Hierarchy: 1,900 subfolders are very large; consider flattening or reorganizing: Reduce nesting levels (no more than 3-4 levels deep). Consolidate related subfolders. Use naming conventions (e.g., Category-Subcategory-Item) instead of deep nesting. Test with a subset of ~50-100 folders first to verify it works
- Verify File Types & Sizes: Check that all files in subfolders are supported (PDF, Word, Excel, PowerPoint, etc.). Remove or exclude files >100 MB. Ensure no corrupted files or unusual formats are present
- Use Folder Filters or Views: Instead of pointing to the entire folder with 1,900 subfolders, use a SharePoint View with filters: Create a view that filters to specific categories or date ranges, Point the agent to the filtered view instead of the raw folder. This reduces the scope and improves retrieval accuracy
- Check Agent Configuration: In the agent settings, verify the knowledge source is set correctly: Knowledge Source Type: "SharePoint", Folder Path: Confirm it's the correct root folder, Include Subfolders: Ensure this is enabled, Refresh Schedule: Set to daily or weekly refresh
- Clear Agent Cache: There may be a cache issue causing the agent to default to one folder: In agent settings, look for Clear Cache or Reset Knowledge Source. Some agents have a "Refresh Now" button—use it. Wait 15-30 minutes for the cache to fully clear