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

Free Support Forum - aspose.com

Aspose.Net Email product- MAPIContact Error


Currently we are trying to evaluate this product. We need to decide to purchase this tool based on your feedback.

What is the limitation on number of records to retrieve contacts from Exchange Server? Is the tool is able to retrieve the contacts in subfolders?

We are getting "Specified argument was out of the range of valid values." error while executing "MapiContact[] contacts = client.ListContacts(client.MailboxInfo.ContactsUri);" line.

Kindly provide the solution for this product & looking forward to purchase this product.


Hi Balakrishnan,

Thank you for considering Aspose.Email.

I have investigated this issue at my end using the latest version of Aspose.Email for .NET 4.6.0 and could not face any such exception as you have mentioned. There is no such limit on the number of records to be retrieved from the Exchange server. With respect to your query about retrieving contacts from subfolders, I would like to share that Aspose.Email supports doing this. Please refer to the following sample code which retrieves the contacts from a sub-folder of type “Contacts” which is located in the inbox folder. Please try it with the latest version of Aspose.Email and let us know your feedback.

Sample Code:

// Create instance of IEWSClient class by giving credentials

IEWSClient client = GetAsposeEWSClient();

ExchangeMailboxInfo mailbox = client.GetMailboxInfo();

// List all messages from Inbox folder

Console.WriteLine(“Listing all messages from Inbox…”);

//Declare variable for getting specified custom folder uri

ExchangeFolderInfo subfolderInfo = new ExchangeFolderInfo();

//Check if specified custom folder exists

client.FolderExists(mailbox.InboxUri, “NewContacts”, out subfolderInfo);

if (subfolderInfo != null)


// List all the contacts

MapiContact[] contacts = client.ListContacts(subfolderInfo.Uri);

foreach (MapiContact contact in contacts)


// Display name and email address

Console.WriteLine("Name: " + contact.NameInfo.DisplayName +

", Email Address: " + contact.ElectronicAddresses.Email1);



I had the same error, after testing I found out that it was NameInfo.DisplayName property.

either there is a limit on the property size or you have special chars like “() or @” in your contact.

Anyway in my case after I removed “(example@example.com)” from displayas field in contact it fixed the problem


Could you please share such a sample file that possesses the problem you have mentioned.? We’ll analyze the problem in light of your sample file and assist you accordingly.