As a manager, if I fire somebody or they leave, I get access to their mailbox via Outlook365 for like 3 months, just in case I need to grab something from it.
So there must be a way to assign ownership of a mailbox to another user.
It depends on the setup. There are different nuances but through an Admin granted API key you could potentially access all emails. There are safeguards that companies put in place to restrict this as well.