Exception when deleting messages in PST (C# .NET)

Hi,

When deleting messages from “Sent” folder in one of PST, it throws exception with message
“An item with the same key has already been added.”

I’m using FolderInfo.DeleteChildItems() method, and passing list of entryid strings collected by calling FolderInfo.EnumerateMessagesEntryId().ToList();.

Let me know how i can get around it.

Thanks,
Hiren Patel

@hirenp,

I have observed the issue shared by you and request you to please share the source PST with us around with used sample code. I will be able to verify the issue further on my end on provision of requested information.

Mudassir,

I cannot share PST file where i encountered this error since it came from a customer. The sample code is same one i gave you earlier (full solution with a form that allows you to point to pst file, and try to delete all emails).

Is there another way we can troubleshoot this issue? Maybe if you can provide dll with more debugging enabled which creates a log that i can send it to you?

Hiren

@hirenp,

The code for removing the messages has already been shared by you and is working on other PST files as well. The issue most likely is related to particular PST while deleting messages. Unfortunately, without provision of requested information we may not be able to investigate the issue or resolve that.