Microsoft 365 Graph Configuration - Unable To Add Delegated Shared Mailboxes
Categories
(MailNews Core :: Networking: Exchange, enhancement)
Tracking
(Not tracked)
People
(Reporter: anish.888222, Assigned: edicharry, NeedInfo)
References
(Blocks 1 open bug)
Details
Attachments
(9 external files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Steps to reproduce:
Steps to Reproduce:
- Set up a primary Office 365 account in Thunderbird using Microsoft Graph.
- Attempt to add a delegated shared mailbox that the primary account has permissions to access.
- Complete the authentication process.
Actual results:
After configuring the O365 account using the Graph API, We ran into an issue adding the shared mailbox. The application is authenticating into my primary mailbox instead of connecting to the delegated shared mailbox.
Expected results:
Thunderbird should correctly map to and display the contents of the delegated shared mailbox using the primary account's delegated credentials.
Updated•2 months ago
|
Updated•2 months ago
|
| Reporter | ||
Comment 1•2 months ago
|
||
Eleanor,
Good Day !
Shared Mailboxes Are Most Important Feature Of Office 365.
We Can't Add One While The Account Configured In Graph.
Please Check & Do The Needful At Earliest.
Thanks,
Anish
| Reporter | ||
Comment 2•2 months ago
|
||
FYI, This Bug Still Present In Version 155.
Comment 3•2 months ago
|
||
I have implemented a possible solution for this issue as part of Bug 2069311.
The corresponding patch is currently under review in Phabricator:
https://phabricator.services.mozilla.com/D323572
You can also build and test my modified version of Thunderbird Desktop from my GitHub branch:
https://github.com/RcRaCk2k/thunderbird-desktop/tree/feature/outlook-365-shared-mailboxes
I made several changes to Thunderbird's Microsoft Graph integration to support shared mailboxes and to allow existing OAuth2 tokens to be reused when the authenticated Microsoft 365 account (i.e. the user's primary account) has already been added to Thunderbird.
To test the implementation:
- Add the primary Microsoft 365 account to Thunderbird and authenticate it using OAuth2.
- Add another account for the shared mailbox.
- Enter the name and email address of the shared mailbox and continue with the manual configuration.
- Select Microsoft Graph as the protocol.
- Use the following Graph API endpoint for a shared mailbox:
https://graph.microsoft.com/v1.0/users/<UPN>/
For the user's own mailbox, use:
https://graph.microsoft.com/v1.0/me/
The shared mailbox can then reuse the OAuth2 authentication of the already configured primary Microsoft 365 account, while the Graph API endpoint determines which mailbox is accessed.
This separates the authenticated OAuth2 identity from the mailbox being accessed and allows delegated shared mailboxes to be configured without requiring a separate interactive OAuth2 login for each shared mailbox.
Feedback and testing of the patch would be very welcome.
| Reporter | ||
Comment 4•2 months ago
|
||
When This Will Be On The Release Channel ?
| Assignee | ||
Comment 5•2 months ago
|
||
The referenced patch is too big for the team to effectively review. I have asked the author to come up with a more incremental approach.
| Reporter | ||
Comment 6•2 months ago
|
||
Thanks Eleanor. We're Awaiting Eagerly.
| Assignee | ||
Comment 7•2 months ago
|
||
Anish, please stop adding me as a needinfo on the issues you are concerned about.
| Reporter | ||
Comment 8•2 months ago
|
||
Eleanor, I am very sorry for any disruption to your workflow, that was certainly not my intention. I wanted to explain that these specific issues are critical to our current project timeline, which is why I was flagging them for your expertise and input.
Comment 9•2 months ago
|
||
Michael, thanks a lot for your efforts to solve this problem. Might it be possible for you to reduce the review burden for the team by breaking up the patch?
| Reporter | ||
Comment 10•1 month ago
|
||
Any Updates For Us On This Request ?
| Assignee | ||
Comment 11•1 month ago
|
||
See bug 2077102 - it appears that users have successfully used IMAP for shared mailboxes, and the user who reported that issue also claimed that shared mailboxes work in EWS as well. I wasn't able to verify with EWS, but it'd be helpful if you're able to try that. The flow the user described to set up the shared mailbox in the other issue is as follows:
- Add your regular user account and set it up as you normally would.
- Add the shared mailbox account.
- When the browser auth flow prompts you for the shared mailbox account, change accounts to your normal user account and authenticate with that.
This process worked for me with Office365+IMAP, but didn't work for me with Office365+EWS or Graph. I'd be interested to know if the Office365+EWS case works for anyone else. If it does, then probably the main issue with Graph is that we're not requesting the correct permissions. So even though EWS is going to get turned off soon, it'd be a very helpful check if you're able to do it.
Comment 12•1 month ago
|
||
Sorry for the long silence on my side. I was away on vacation for quite a while, and after returning I had a rather busy period and unfortunately didn't have enough time to continue working on the patch.
Thank you for the feedback regarding the size of the patch. I understand the concern and will take a closer look at how to split the changes into smaller, more focused patches. I plan to get back to this over the next few days and will update the patches accordingly.
For some additional background on why I started working on the Graph implementation in the first place: using IMAP for multiple shared mailboxes was unfortunately not a viable solution for me either.
With several shared mailboxes configured, the frequency and number of requests made by Thunderbird against the IMAP server caused significant problems. For example, I experienced cases where sent messages were lost. Once Thunderbird got into this state, the only practical workaround was to close Thunderbird completely, wait approximately 1–5 minutes, and then start it again. Otherwise, it would remain stuck in a timeout/throttling loop caused by too many requests.
I encountered a very similar issue with the Graph API, which is also addressed by part of my current patch.
Microsoft Graph permits fewer concurrent requests than Thunderbird currently attempts to perform. When Graph responded with a throttling response, Thunderbird also ignored the retry delay provided by the server in the response headers. Instead, it continued sending additional requests immediately.
This effectively made the situation worse: Thunderbird kept issuing requests while the service was already asking it to back off, causing the throttling period to increase further and resulting in a loop that was difficult to recover from.
So, in addition to the shared mailbox functionality itself, part of my patch addresses Graph API throttling and proper handling of the server-provided retry timeout.
I agree that these are logically separate concerns and that the throttling/retry handling should therefore be separated from the shared mailbox functionality into its own focused patch.
Thanks for your patience, and again, sorry for the delayed response.
| Assignee | ||
Comment 13•1 month ago
|
||
Yes, please only address a single issue per patch. We're actively working the 429 throttling issues right now through multiple bugzilla bugs, so you don't need to worry about that.
In terms of how to make this smaller, I'd suggest starting by making shared mailboxes with graph work exactly like they do with IMAP. So don't worry about new UIs or anything, just make it so that we can connect to a shared mailbox using the three steps I outlined above. I think that will really help limit the size of your patch. We can take on UI/UX improvements as follow-on issues.
Note that for graph specifically, I think we're going to run into oauth scope issues. I'll review our scopes to make sure that shared mailbox permissions are included, and if they aren't, I'll put together a patch to add them to our oauth requests.
Comment 14•1 month ago
|
||
Hi,
Just wanted to throw it out there that we're also testing Thunderbird in our organisation. We are also experiencing the same reported issue with adding shared/delegated mailboxes with Office 365 for Business. Looking forward to any updates on the potential fix.
Comment 15•1 month ago
|
||
(In reply to linux from comment #14)
Hi,
Just wanted to throw it out there that we're also testing Thunderbird in our organisation. We are also experiencing the same reported issue with adding shared/delegated mailboxes with Office 365 for Business. Looking forward to any updates on the potential fix.
As a temporary workaround, you can enable IMAP access to those shared mailboxes (also check that IMAP has not been disabled at the organization level).
Use these parameters:
IMAP: outlook.office365.com, port 993, SSL
SMTP: smtp.office365.com, port 587, STARTTLS
Set authentication to OAuth2
When you proceed, it will open an MS365 login dialog, click “Use a different account” to change from shared@domain.tld (which should have no credentials set) to your account which has access to the inbox.
Comment 16•1 month ago
|
||
(In reply to Martino P. from comment #15)
(In reply to linux from comment #14)
Hi,
Just wanted to throw it out there that we're also testing Thunderbird in our organisation. We are also experiencing the same reported issue with adding shared/delegated mailboxes with Office 365 for Business. Looking forward to any updates on the potential fix.
As a temporary workaround, you can enable IMAP access to those shared mailboxes (also check that IMAP has not been disabled at the organization level).
Use these parameters:
IMAP: outlook.office365.com, port 993, SSL
SMTP: smtp.office365.com, port 587, STARTTLS
Set authentication to OAuth2When you proceed, it will open an MS365 login dialog, click “Use a different account” to change from shared@domain.tld (which should have no credentials set) to your account which has access to the inbox.
Hi, thanks for the quick response.
Unfortunately for our organisation IMAP is not an option, as it has been disabled. We're currently only allowed to use the Graph API. I can bring IMAP up to our security team, but I feel we will end up having to wait for a fix for the Graph API/shared mailbox issue. I just felt it might be a good idea to show a +1 for this bug as an organisation trying to use thunderbird experiencing the same issue that was reported.
Comment 17•1 month ago
|
||
Hi Michael,
If it would help, feel free to jump into chat to discuss with the team:
https://matrix.to/#/#maildev:mozilla.org
| Assignee | ||
Comment 18•1 month ago
|
||
I did some investigation on this today and it appears that really all we're missing in our current graph implementation is to provide the email address associated with a request. Our current implementation will work to access shared mailboxes if we replace our default use of the /me base URL with /users/<address>. This seems straightforward enough that we can prioritize it without planning multiple large changes.
Comment 20•1 month ago
|
||
Add an operation adapter for /users/{id-or-UPN} without duplicating generated
request builders. Preserve opaque continuation URLs, HTTP methods, headers,
bodies, and queries. Reject empty identifiers and fail batch construction as
a whole if an inner request cannot be built.
This is the SDK prerequisite for the smaller shared-mailbox approach requested
in bug 2067186 comment 18. It does not change account setup or retry policy.
Prepared with OpenAI Codex assistance.
Updated•1 month ago
|
Comment 21•1 month ago
|
||
Request and require Mail.ReadWrite.Shared and Mail.Send.Shared for Microsoft 365
Graph accounts. A stored personal-mail-only grant must not prevent a new
consent flow. Keep the existing per-mailbox OAuth object and token keys, and
test that another mailbox's or delegate's token is not selected implicitly.
This companion patch makes the scope requirement explicit for review alongside
the native mailbox addressing change. It leaves EWS, IMAP, and custom OAuth
provider details unchanged. These shared scopes apply to work/school accounts.
Prepared with OpenAI Codex assistance.
Comment 22•1 month ago
|
||
Use the existing setup flow: configure the mailbox principal name as the
account username and choose the delegate account in Microsoft's sign-in page.
Address individual operations and batch items to that mailbox. Verify its root
mail folder instead of reading another user's directory profile.
Mark new incoming and outgoing accounts during the existing setup/verification
flow. Existing unmarked accounts retain /me and their cached delta identity;
do not silently migrate potentially incorrect caches from older unsupported
shared-account setups. Those shared accounts must be added afresh.
Add independent synthetic mailbox stores and native coverage for denied access,
paging/delta sync, overlapping IDs, read/delete operations, MIME downloads,
sending, configuration changes, separate cache paths, outgoing identities, and
account reload. Preserve opaque server continuation links and the service batch
root. No new setup UI, token-picker UI, or throttling changes are included.
This follows the approach requested in bug 2067186 comment 18 after D323572's
review. Michael Rack's existing revision and contribution remain separate;
this implementation and the independent-mailbox tests were prepared separately.
Prepared with OpenAI Codex assistance.
Updated•1 month ago
|
Comment 23•1 month ago
|
||
Offer Graph alongside discovered public-cloud Microsoft 365 settings without
changing the discovered default. Fill the Graph endpoint and OAuth method and
use the mailbox address, without carrying over passwords, EWS custom OAuth
settings or certificate exceptions. Preserve existing Graph alternatives and
respect the Graph feature preference.
Label Graph as Experimental in the setup results, Exchange type cards and manual
protocol list. Explain that shared mailbox access uses the delegate's own sign-in.
Use the existing badge style and keep its status visible for either recommendation.
Add component and headless UI coverage for discovery boundaries, preserved
settings, mouse/keyboard choice and visible experimental status. The tested
consent and account-picker changes remain in the separate shared-mailbox reviews.
Prepared with OpenAI Codex assistance.
Comment 24•1 month ago
|
||
Offer a shared-mailbox label choice in the Graph discovery results, Exchange type
step and manual setup. Persist the choice separately from explicit Graph routing,
which is also used for personal accounts. Expose the choice in Account Settings.
Show a localized Shared badge on folder-pane rows that include the account name,
and include shared status in the row's accessible label and tooltip. Update open
folder panes when the saved choice changes. Leave account names, addressing,
authentication and permissions unchanged.
Cover explicit choice, account reload, setup protocol transitions, settings
roundtrip, live folder-pane updates, accessible status and Unified row naming.
Prepared with OpenAI Codex assistance.
Comment 25•1 month ago
|
||
Resolve an explicit graph.authServerKey only to a compatible active primary
Graph account. Preserve the shared mailbox address and local store while
incoming and outgoing authentication use the primary identity and provider.
Reject missing, removed, chained, self-linked or incompatible primaries
without falling back to another identity. Keep unlinked accounts independent.
Allow JavaScript raw-token consumers to request silent authentication while
preserving the existing one-argument XPCOM behavior.
Cover two shared targets, sending, token rotation, independent credentials,
invalid links and background token retrieval with synthetic credentials.
Prepared with OpenAI Codex assistance.
Comment 26•1 month ago
|
||
Offer experimental per-primary-account discovery in Account Settings. Use
authenticated public-cloud Autodiscover to retrieve Delegate alternatives,
verify their Graph mailbox access and create separate labeled accounts with
explicit incoming/outgoing links to the primary authentication identity.
Keep email synchronization on Graph. Do not infer a parent for existing
accounts or enumerate the tenant directory.
Run opted-in background discovery silently on startup and account refresh.
Respect retry deadlines, cancellation, duplicate accounts and exclusions for
deliberately removed mailboxes. Offer an explicit restore action. Restrict
discovery to the built-in public-cloud provider; custom OAuth applications,
group-only grants and disabled automapping need separate consideration.
Cover parsing, access checks, store/identity separation, account persistence,
removals/restoration, primary removal, silent authentication, cancellation,
request privacy, throttling and the Account Settings controls.
Prepared with OpenAI Codex assistance.
Comment 27•1 month ago
|
||
Group explicitly linked, labeled shared Graph accounts in All Folders while
retaining their separate server roots, folder URIs and mail stores. Preserve
normal folder ordering before the shared account group and account order
within it. Keep independent labeled accounts at the top level.
Support live link/label changes, mode rebuilds, saved expansion state and
keyboard arrows. Promote shared rows when the primary is removed, and restore
only selections that still have a live folder after tree indexes update.
Keep collapsed mailbox-size calculations within their own account.
Cover nested indentation, both collapse levels, reordering, new folders,
invalid/chained parents, mode rebuilds, size isolation and primary removal.
Prepared with OpenAI Codex assistance.
Comment 28•1 month ago
|
||
Hi Hunter,
Thanks for your efforts on this, they are very much appreciated.
This weary group of maintainers is hoping for some human connection and would love to chance to discuss. Are you on Matrix? Perhaps we can chat some of this through in https://matrix.to/#/#maildev:mozilla.org ?
Comment 29•1 month ago
|
||
(In reply to Toby Pilling [:tobyp] from comment #28)
Hi Hunter,
Thanks for your efforts on this, they are very much appreciated.This weary group of maintainers is hoping for some human connection and would love to chance to discuss. Are you on Matrix? Perhaps we can chat some of this through in https://matrix.to/#/#maildev:mozilla.org ?
Hello Toby,
I have not used Matrix before, but let me look into getting it set up.
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Updated•28 days ago
|
| Assignee | ||
Updated•22 days ago
|
| Assignee | ||
Comment 30•22 days ago
|
||
Updated•22 days ago
|
| Assignee | ||
Updated•22 days ago
|
| Assignee | ||
Updated•22 days ago
|
| Assignee | ||
Comment 31•20 days ago
|
||
Thanks for your patience everyone! This is going to land in 162.
| Assignee | ||
Updated•20 days ago
|
| Assignee | ||
Updated•19 days ago
|
| Assignee | ||
Comment 33•19 days ago
|
||
Just did. Note that only my patch is the one to land here.
Comment 34•17 days ago
|
||
Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/da714e80e858
Enable shared mailboxes for Graph accounts. r=babolivier
Description
•