I've noticed that my ost-file for my Exchange account is much (much!) larger than my own mailbox.
Aside from my own mailbox, I also have the mailbox of my manager and a colleague added to Outlook as I am a delegate for them. It appears that Outlook fully caches these mailboxes which both include a lot of large emails.
Is there any way I can configure Outlook to only cache the Calendar and Contacts folder?
Outlook indeed fully caches secondary Exchange mailboxes as well and stores that cached data in the same ost-file as your own mailbox.
Outlook 2016 and later respect the Sync Slider setting for your Exchange account, so when that is set to cache only 6 months, it will also only cache 6 months for the Shared Mailboxes.
Also note that since Outlook 2013, Outlook compresses certain contents within the ost-file so the size increase may not be as dramatic as it used to be with Outlook 2010.
CacheOthersMail Registry key
To set Outlook to fully exclude email folders when caching Shared Mailboxes, you can change or add the
CacheOthersMail Registry key as specified below while Outlook is closed;
New behavior and compacting the ost-file
Once you’ve changed the registry key and restarted Outlook, only the Calendar, Contacts, Tasks and Notes folders of the secondary mailbox will be cached.
When you are accessing a folder which is cached, the connection state in the right bottom corner will say “Connected”. When you are accessing a folder which isn’t cached, this connection state will say “Online”.
Your ost-file will shrink over time when Outlook is running and your computer is idle. As an alternative you can use the Compact Now feature or rename your ost-file to .old to completely rebuild your ost-file.