Skip to content

fix(Microsoft Outlook Trigger Node): Show nested subfolders in folder dropdowns#28759

Merged
BerniWittmann merged 1 commit intomasterfrom
node-4852-outlook-trigger-only-shows-top-level-mail-folders-in-folders
Apr 28, 2026
Merged

fix(Microsoft Outlook Trigger Node): Show nested subfolders in folder dropdowns#28759
BerniWittmann merged 1 commit intomasterfrom
node-4852-outlook-trigger-only-shows-top-level-mail-folders-in-folders

Conversation

@BerniWittmann
Copy link
Copy Markdown
Member

@BerniWittmann BerniWittmann commented Apr 21, 2026

Summary

The Microsoft Outlook Trigger's "Folders to Include" / "Folders to Exclude" dropdowns only surfaced top-level mail folders, so users couldn't target Inbox subfolders. Two bugs combined: getSubfolders used a non-paginated request (dropping children past the first page), and getFolders called it without the addPathToDisplayName flag, so subfolders rendered as bare names and looked indistinguishable from top-level folders.

This change switches child folder fetches to microsoftApiRequestAllItems for full pagination and enables the path prefix in both getFolders (loadOptions) and searchFolders (resource locator), so picker entries now render as Inbox/Work/Q2. The action node's message-filter dropdown benefits from the same fix.

How to test: Add a Microsoft Outlook Trigger, open Filters → Folders to Include, and confirm nested subfolders appear with full paths. Verify the same on Microsoft Outlook → Message → Get Many → Filters. Unit tests cover pagination via @odata.nextLink, recursive path building, and the childFolderCount === 0 short-circuit.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-4852
Fixes #17078

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with `Backport to Beta`, `Backport to Stable`, or `Backport to v1` (if the PR is an urgent fix that needs to be backported)

🤖 PR Summary generated by AI

… dropdowns

Paginate child folder requests with microsoftApiRequestAllItems so folders with many
children are returned in full, and prefix subfolder display names with their parent
path so they are distinguishable from top-level folders in the picker.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant Bot added n8n team Authored by the n8n team node/improvement New feature or request labels Apr 21, 2026
@BerniWittmann BerniWittmann marked this pull request as ready for review April 21, 2026 07:37
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Performance Comparison

Comparing currentlatest master14-day baseline

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 386.00 MB 386.00 MB 392.50 MB (σ 11.06) +0.0% -1.7%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1273.60 MB (σ 10.49) +0.0% -0.3%

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-rss-baseline 222.46 MB 278.98 MB 289.99 MB (σ 41.20) -20.3% -23.3% ⚠️
memory-heap-used-baseline 115.36 MB 114.41 MB 114.45 MB (σ 0.27) +0.8% +0.8% 🔴

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-heap-used-baseline 187.19 MB 186.52 MB 186.43 MB (σ 0.26) +0.4% +0.4% 🔴
instance-ai-rss-baseline 343.68 MB 389.20 MB 366.52 MB (σ 22.66) -11.7% -6.2% ⚠️
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Architecture diagram
sequenceDiagram
    participant UI as n8n UI (Dropdown/Locator)
    participant Node as Outlook Node (Methods)
    participant Transport as Subfolder Helper (getSubfolders)
    participant Helper as MS API Helper (RequestAllItems)
    participant Graph as Microsoft Graph API
    
    Note over UI,Graph: Folder Retrieval Flow (loadOptions or listSearch)
    
    UI->>Node: Request folders list
    Node->>Helper: GET /mailFolders
    Helper->>Graph: Request top-level folders
    Graph-->>Helper: Return folder list
    Helper-->>Node: Return folder objects
    
    Node->>Transport: CHANGED: getSubfolders(folders, addPath=true)
    
    loop For each folder where childFolderCount > 0
        Transport->>Helper: CHANGED: Fetch ALL children via microsoftApiRequestAllItems
        
        loop Pagination
            Helper->>Graph: GET .../childFolders
            Graph-->>Helper: Return items + @odata.nextLink
        end
        
        Helper-->>Transport: Return flattened list of subfolders
        
        opt NEW: if addPathToDisplayName is true
            Transport->>Transport: Recursively prepend parent path<br/>(e.g., "Inbox/Work/Q2")
        end
    end
    
    Transport-->>Node: Return complete flat list with paths
    Node-->>UI: Return INodePropertyOptions (Display Name + ID)
Loading

Copy link
Copy Markdown
Member

@alexander-gekov alexander-gekov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and subfolders appear correctly in the two places mentioned in the description 👍

@BerniWittmann BerniWittmann added this pull request to the merge queue Apr 28, 2026
Merged via the queue into master with commit 3409a67 Apr 28, 2026
110 of 113 checks passed
@BerniWittmann BerniWittmann deleted the node-4852-outlook-trigger-only-shows-top-level-mail-folders-in-folders branch April 28, 2026 07:31
@n8n-assistant n8n-assistant Bot mentioned this pull request Apr 28, 2026
@n8n-assistant
Copy link
Copy Markdown
Contributor

n8n-assistant Bot commented Apr 28, 2026

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team node/improvement New feature or request Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outlook Trigger: “Folders to Include” missing folders in dropdown

2 participants