Office 365 shared mailbox

Hi


I have FULL access to a shared mailbox hosted in Office 365.

I can connect to the main mailbox.

How can I connect to the shared mailbox to:
  • read emails
  • create folders in the shared mailbox
  • move emails from the inbox to the newly created folder
  • mark emails as read in the shared mailbox
I am able to do all this in the main mail box but not in the shared mailbox.

Do you have an example?

Hi Eric,

Thank you for writing to Aspose Support team.

In order to achieve this, you can use the Exchange Impersonation feature of the API. Please try it at your end and let us know if you need further assistance in this regard.

Sample Code:

// Create instance’s of EWSClient class by giving credentials

IEWSClient client1 = EWSClient.GetEWSClient(“[https://outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)”, “testUser1”, “pwd”, “domain”);

IEWSClient client2 = EWSClient.GetEWSClient(“[https://outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)”, “testUser2”, “pwd”, “domain”);

{

string folder = “Drafts”;

try

{

foreach (ExchangeMessageInfo messageInfo in client1.ListMessages(folder))

client1.DeleteMessage(messageInfo.UniqueUri);

string subj1 = string.Format(“NETWORKNET_33354 {0} {1}”, “User”, “User1”);

client1.AppendMessage(folder, new MailMessage(“User1@exchange.conholdate.local”, "To@Aspose.com", subj1, “”));

foreach (ExchangeMessageInfo messageInfo in client2.ListMessages(folder))

client2.DeleteMessage(messageInfo.UniqueUri);

string subj2 = string.Format(“NETWORKNET_33354 {0} {1}”, “User”, “User2”);

client2.AppendMessage(folder, new MailMessage(“User2@exchange.conholdate.local”, "To@aspose.com", subj2, “”));

ExchangeMessageInfoCollection messInfoColl = client1.ListMessages(folder);

client1.ImpersonateUser(ItemChoice.PrimarySmtpAddress, “User2@exchange.conholdate.local”);

ExchangeMessageInfoCollection messInfoColl1 = client1.ListMessages(folder);

client1.ResetImpersonation();

ExchangeMessageInfoCollection messInfoColl2 = client1.ListMessages(folder);

}

finally

{

try

{

foreach (ExchangeMessageInfo messageInfo in client1.ListMessages(folder))

client1.DeleteMessage(messageInfo.UniqueUri);

foreach (ExchangeMessageInfo messageInfo in client2.ListMessages(folder))

client2.DeleteMessage(messageInfo.UniqueUri);

}

catch { }

}

}

Hi


I have seen that post before but because I am really using an office 365 “shared mailbox” and not a real one, that mailbox does not have a user id & password.

for more info about Shared Mailbox, check Create a shared mailbox - Microsoft 365 admin | Microsoft Learn

Hi Eric,

We created a shared mailbox by following instructions on this link: [https://support.office.com/en-us/article/Create-shared-mailboxes-in-Office-365-for-Small-Business-ECACF5B0-B5C8-449F-A89A-B7E87DCB55D4?ui=en-US&rs=en-US&ad=US&fromAR=1 ](https://support.office.com/en-us/article/Create-shared-mailboxes-in-Office-365-for-Small-Business-ECACF5B0-B5C8-449F-A89A-B7E87DCB55D4?ui=en-US&rs=en-US&ad=US&fromAR=1) .

A shared mailbox asks for a definite email address and you can not leave this field empty. Once you provide the email address, you can assign it a password by going to the [users tab ](http://prntscr.com/cylbxo). After this, you can access the shared mailbox with this email and password. Once such mailbox we have created is here:

**Username:** [AsposeShared@AsposeOct2016.onmicrosoft.com](mailto:AsposeShared@AsposeOct2016.onmicrosoft.com)

Password: Aspose1234

Please try it at your end and let us know your feedback.

So using Aspose library, there is no way of accessing a real virtual (without password) shared mailbox without a password?


If I assigned a password, it then becomes a real mailbox and then I have to start paying for it (where a shared mailbox is free).

Outlook recognize them correctly.

Hi Eric,


Aspose.Email API allows to access other user’s mailbox using the following methods:

1. Exchange Impersonation
2. Accessing other user’s mailbox
3. oAuth Support for EWS

We couldn’t find another way to access a shared mailbox as per your requirements and seems it is not possible other than providing the username and password. Please let us know if we can be of any additional help to you in this regard.

As this kind of mailbox will become more popular, are you planning to support it in the “near” future?

Hi,


We have requested from our Product team to share its feedback about this requirement and will update you here once there is some information available in this regard.

Hi,


Have you tried the method, Accessing other User’s Mailbox, as we recommended you earlier? We hope it will meet your requirements. Please give it a try and let us know your feedback.

Unless I missed something from your link, nothing in there is for a real “Office 365 Shared Mailbox”. That kind of mailbox does not have a password assign to it. The mailbox exist (without a password) and it is shared to another fully-registered user.

Hi,


In order to perform any action on own or a shared mailbox, you need to first login to the Exchange Server using your own id using our API. Once you are logged in and you have the authorization rights to access the shared mailbox, you can then use the sample code we mentioned to you in the link above i.e. Accessing other user’s mailbox. We are sorry but there is no other way where the shared mailbox can be accessed using the API.