I’m trying to find a workaround for this error, I’m using Foreach mailmessages and inside i need to remove an email from the list and continue looping through the rest of the mailmessages.
Has anyone run into this , what can i do to solve this?
@Ayasoliman Most probably you cannot perform the operation in that way, since you’re trying to remove an item from the Collection which you are already using it to loop. There are other ways to remove items based on a condition such as using Linq or you can use a long approach of copying items to another List.
If you want to use Linq, can you provide the condition based on which you would want to remove the mail items ?