Ewsclient and cache folders

When connecting to Exchange with ewsclient and listing folders, there are folders that are used for contact caching.

5/11/2017 3:28:50 PM: [Enumerate (I)] Contacts\Recipient Cache(2) Folder type is Contact

Trying to access the message as a contact fails. According to what I have been able to find, this is a hidden folder. Here is one of the responses to questions about the recipient cache.

From the article WellKnownFolderName enumeration, we can know that the RecipientCache field is applicable for clients that target Exchange Online and versions of Exchange starting with Exchange Server 2013.

This is a new Exchange 2013 folder which is a hidden subfolder of the Contacts folder with a mailbox and its purpose isn't really documented at the moment, but contains like the AutoComplete cache, Addresses for Sent Emails.

Would it be possible for the ewsClient to show the hidden flag (if it even exists) in the list folders collection?

Thanks

1 Like

Hi Jon,

Thank you for writing to Aspose Support team.

We’ve tried to find such hidden subfolder of the Contacts folder, but are not able to get any such entry as subfolder entry under Contacts folder. Could you please help us locate one such folder on Office 365 test account? Please share your sample code that we can use to investigate the issue for assisting you further. We already have a test account intact on Office365 and you can use its information to guide us further in this regard.

Account Credentials

Username: UserTwo@AsposeApril2017.onmicrosoft.com

Password: Aspose1234

The only way I was able to replicate this was by connecting to our Exchange Server which is a 2016 server. I had to use VPN with the IP address of the PC running the Server. Do you have the URL to connect to for the account info you provided. I will try and see if I can see anything on that site. I believe you will have to have used the account in exchange, have some contacts and send and receive mail to have exchange create the caches.

There is a lot of code that does error recovery, restarting a collection if it is interrupted, filtering, etc. but at the heart of the loop is a recursive loop the starts at the root and calls a method to get folders at the current level, call the recursion for any child folder encountered. The folders are added to a collection so that when the recursion is complete the collection contains all the folders. At the end of the code I added the PPLExchangeFolderInfo definition. It is really just a
ExchangeFolderInfo object with an enumeration classify the message classes into a common name space for all our other objects.

Dictionary folderlist = new Dictionary<string,
PPLExchangeFolderInfo>();

emi = ewsClient.GetMailboxInfo(); // get mailbox info
efic = ewsClient.ListSubFolders(emi.RootUri); // get list of folders in the root
foreach (ExchangeFolderInfo efi in efic) // iterate each folder in parent
{
folderlist.Add(efi.DisplayName, pplEFI);
ExchangeGetSubfolders(efi.DisplayName,
pplEFI,
folderlist,
pcp,
ref FolderRestartComplete); // get next folder

}
// at this point folderlist contain information on all the folders in this account
return folderlist;

private void ExchangeGetSubfolders(string parentpath,
PPLExchangeFolderInfo CurrentLevel,
Dictionary Outefi,
pplCommonData.ProgressCheckPoint pcp,
ref bool FolderRestartComplete)
{
efic = ewsClient.ListSubFolders(CurrentLevel.efi);

foreach (ExchangeFolderInfo efi in efic) // iterate each folder in parent
{
Outefi.Add(newParentPath, pplEFI); // add to the list
ExchangeGetSubfolders(efi.DisplayName,
pplEFI,
folderlist,
pcp,
ref FolderRestartComplete); // get next folder

}

Here is the main part of the PPLExchangeFolderInfo class:

public class PPLExchangeFolderInfo
{
public ExchangeFolderInfo efi;
public MESSAGE_CLASS mc;

Hi Jon,

The Office 365 uses Exchange server 2016 at its base and you can use the following URL for working with the IEWSClient of the API:

Exchange Server URL: [https://outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)

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

I was able to connect and run against your exchange. I have attached a log with three errors that occurred. The are three runs each is separated by a ============== in the file. I tried to annotate the file to help see where the errors happened. My notes are preceded by <----------

Feel free to ask any questions about the logs. Thanks

Hi Jon,


Can you please share sample runnable code in the form of a simple console application that we can use to reproduce the problem at our end? By looking at your code sample, it seems you are going through each item in every folder/subfolder and fetching those. But we are not able to see any logic for turning ON/OFF the filters for these operations. A simplified runnable code will help us investigate the issue quickly and assist you further.
I have attached a program that shows a couple of the issue.

Hi,


Thank you for sharing sample project.

We were able to observe the issue with the PersonMetaData and Recipient Cache folder that contains empty items, resulting in empty fetched items. However, these are known to Microsoft as well and at present, Aspose.Email API does not have any flag to show/hide these as hidden/cache from the lists of folders retrieved from the server. We’ve requested our Product team to share if there could be some way to avoid listing such folders and will soon share our findings here with you as the feedback is available.
Thank you for the time being I have added code to ignore folders that contain PersonMetaData, Cache or HOLIDAYS. If you run the latest attached sample code and look at the United States holidays folder you will see there are 159 items. Apparently there at 10 entries that raise an exception. Here is an excerpt of the output:

Processing United States holidays
FromMailMessage subject is New Year's Eve error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Christmas Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Christmas Eve error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Veteran's Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Halloween error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Independence Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is St. Patrick's Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Valentine's Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is Groundhog Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FromMailMessage subject is New Year's Day error is Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Processing Contacts

The other entries appear to process fine.

Hi,


We have tested your test.cs file at our end with the latest version of the API and the errors with MapiMessage.FromMailMessage raise only for the 3 ics files that we have already shared with you in other thread which is specific to this issue.
I checked and the reference for Aspose.Email is 17.5.0.0. I did reuse the same file name so maybe I did not get the latest test code attached. I have attached test1.zip. It is very similar to test.zip but at the end there is the addition of the following code:

if (mm == null) // does object have data
{ // yes -
Console.WriteLine("Mail message is null");
}
else
{
try
{
MapiMessage mapimessage = MapiMessage.FromMailMessage(mm, MapiConversionOptions.UnicodeFormat); // convert the mail message to mapi
}
catch (Exception e1)
{
Console.WriteLine("FromMailMessage subject is " + emi2.Subject + " error is " + e1.Message);
}
// Console.WriteLine("Mail message retrival succeeded");
}

Hi,


We have observed that if license is not applied, we get these Argument out of range exceptions. If license is applied, we again get only 3 exceptions. Could you please confirm to us if you experience the same at your end?
I get the same results. With the license applied there are only 3 errors in the holidays folder and they are date exceptions.
Year, Month, and Day parameters describe an un-representable DateTime.

Hi,


1. We have logged your requirement of marking the items from hidden folders with a flag as EMAILNET-38747 for further consideration by our Product team. We’ll update you here once there is some feedback or a fix version available in this regard.

2. The issue of license impact on conversion of ICS files to MSG has also been logged in our issue tracking system with id: EMAILNET-38748. Our product team will look into it further and you will be notified here once there is some information or a fix version available in this regard.

We regret the inconvenience caused to you with respect to the bugs found in the API.
Thank you, great support, as usual... Will the issue with the date error also be covered in one to this open items?

Thanks

Hi,


Yes, all the issues we have logged against your request for enhancement as well as the bugs (with and without application of license) will be considered further by our Product team for investigation. We’ll update you here once there is some information available in this regard.

The issues you have found earlier (filed as EMAILNET-38747) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.