Use the following user format:
Username@DomainName\SharedMailboxAlias
Remember to escape slash \ character.
In case of Office 365 SharedMailboxAlias is a local part (no domain and no ‘@’) of the full email address (“Email address” input on “new shared mailbox” screen).
You must use Login method:
using (Imap client = new Imap)
{
client.ConnectSSL("outlook.office365.com");
client.Login(@"Username@DomainName\SharedMailboxAlias", "UserPassword");
//...
client.Close();
}
UseBestLogin for Outlook365 uses LoginPLAIN internally (this is the only method Outlook365 claims to support), and this syntax doesn't work for shared mailboxes with LoginPlain.
Alternatively you can use LoginPLAIN to login as a different user:
using (Imap client = new Imap)
{
client.ConnectSSL("outlook.office365.com");
client.LoginPLAIN("SharedMailboxAlias", "Username@DomainName", "UserPassword");
//...
client.Close();
}
Here you you can find more information about accessing shared mailbox in other Exchange versions.