I am trying to use Aspose to connect to an Exchange Server 2010 to get into a mail box and fetch mails.
How do I check mails in public folders?
If I use ListFolders(), it only lists the folders in the mail box, not the Public Folders.
I am trying to use Aspose to connect to an Exchange Server 2010 to get into a mail box and fetch mails.
How do I check mails in public folders?
If I use ListFolders(), it only lists the folders in the mail box, not the Public Folders.
Hi Robert,
static void Email_711917()<o:p></o:p>
{
IEWSClient client = GetAsposeEWSClientTest3();
ExchangeFolderInfoCollection coll = client.ListPublicFolders();
foreach(ExchangeFolderInfo FolderInfo in coll)
{
ExchangeMessageInfoCollection MsgColl = client.ListMessages(FolderInfo.Uri);
foreach(ExchangeMessageInfo MessageInfo in MsgColl)
{
MailMessage msg = client.FetchMessage(MessageInfo.UniqueUri);
}
}
}
public static IEWSClient GetAsposeEWSClientTest3()
{
const string mailboxUri = "https://exchange.domain.com/ews/Exchange.asmx";
const string domain = @"";
const string username = @"username";
const string password = @"password";
NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
return client;
}
Thanks. That does the trick.
You are welcome.