+1 vote

Hi,

I have an office365 account, which is the main account, but I can add sub accounts under that account. e.g my main account is ben.riches@dogoffice.co.uk I then have a sub account (hello@dogoffice.co.uk) that uses the above email address as the username and the same password, as it's just a sub account. How do I only read emails from the sub account?

Regards,

Ben

by (450 points)

1 Answer

0 votes
 
Best answer

As this is rather Office365 question I'm not sure if we are able to help.

Have you tried logging as it was a completely separate account:

imap.UseBestLogin("sub-main@example.com", "password");

Are you sure this is not an email alias? I wasn't able to find any documentation on sub accounts in Office 365.

If that is a case, you can log in using your standard credentials and then perform search on To and Cc headers:

imap.UseBestLogin("main@example.com", "password");
List<long> uids = imap.Search()
    .Where(Expression.Or(
        Expression.To("sub-main@example.com"),
        Expression.Cc("sub-main@example.com")));

[Edit]

It seems you can do this using shared mailbox syntax:

imap.Login(
    "Username@DomainName\\SharedMailboxAlias", 
    "password");

More details can be found here:
https://www.limilabs.com/blog/access-shared-delegate-mailbox-exchange-server

by (297k points)
selected by
Within outlook or office365 online I can login as me but then open another mailbox.

Regards,

Ben
I done it this way:
imap.Login(@"Username@DomainName\SharedMailboxAlias", "password");

Regards,

Ben
...