We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Connect to a User's Online Archive

How can I find out if a user has an archive and connect to it? There is no explicit method about it and no overload.

Server 2013 Exchange

Hi Tomasz,


Thank you for writing to Aspose Support team.

Could you please elaborate what you mean by Archive? Aspose.Email API doesn’t have any such indication if an account exists or not, and raises exception if it is unable to connection to an Exchange Server account. Please share more details for further analysis at our end.
Exchange 2013+ has a feature of "Online Archive"

It is basically a second mailbox managed by exchange that gets items moved to it through a retention policy. It is equal to hot storage and cold storage, hot storage is current mail items and cold storage is the older items that are only accessed occasionally. These features are built into Exchange 2013 and 365. Is there any way to get access to a user's online archive

https://www.petri.com/exchange-online-archiving

I would assume I could do something like:

IEWSClient client = GetExchangeEWSClient();
//default to mailbox
ExchangeMailboxInfo emi = client.GetMailboxInfo(primarySMTP);
//Check for archive
if(emi.HasOnlineArchive)
{
//added bool at the end to connect to online archive
//overloaded method, should default to mailbox as it would always be there
ExchangeMessageInfoCollection coll = client.ListMessages(emi.RootUri, query, true,true);
}
else
{
//bool not needed as you will just connect to mailbox
//for backwards compatibility
ExchangeMessageInfoCollection coll = client.ListMessages(emi.RootUri, query, true,false);
}


This would simplify everything and it would fit nicely into the design without breaking any code moving forward.

Hi Tomasz,


Thank you for providing more detail. This feature is currently not supported and logged as new feature request under Id: EMAILNET-38714 for further consideration by the product team. You will be automatically notified once any update is received in this regard.

Hi Tomasz,


Could you please try the following code sample at your end and let us know if it serves what you are looking for? We need your feedback to investigate the possible solution further.

Sample Code

string serviceUri = “https://…/exchange.asmx”;
string email = "test@abc.com";
string password = “***”;

using (IEWSClient client = EWSClient.GetEWSClient(serviceUri, new NetworkCredential(email, password)))
{
// Archive Distinguished folder IDs
// “archiveroot” - The root of the archive mailbox
// “archivemsgfolderroot” - The message folder root in the archive mailbox
// “archiveinbox” - The Inbox folder in the archive mailbox
// “archivedeleteditems” - The Deleted Items folder in the archive mailbox

// check if “archiveroot” folder exists
if (client.ListItems(“archiveroot”).Length == 0)
{
Console.WriteLine(“archivemsgfolderroot not found”);
return;
}
// get subfolders and messages from “archivemsgfolderroot”
ExchangeFolderInfo archiveMsgRoot = client.GetFolderInfo(“archivemsgfolderroot”);
ExchangeFolderInfoCollection archiveMsgFolders = client.ListSubFolders(archiveMsgRoot.Uri);
foreach (ExchangeFolderInfo folder in archiveMsgFolders)
{
Console.WriteLine(“folder: " + folder.DisplayName);
if (folder.TotalCount > 0)
{
ExchangeMessageInfoCollection messages = client.ListMessages(folder.Uri);
foreach (ExchangeMessageInfo message in messages)
{
Console.WriteLine(” message: " + message.Subject);
}
}
}
}