Remove all attachments from mailmessage

Hi there folks,

I have a problem when deleting files which were previously picked up by an invoke menthod to add them into attachments. When I try to delete them (as there is a temp folder and I don’t need them after finishing my cycle) I’m getting an error message saying cannot delete as files are in use… assuming it the code itself is using them.
So my questions would be how to remove all or delete or assign empty value to attachments from a mailmessagem so later on I can delete the actual file as well?

Many thanks in advance,
Richárd

Try this