Get the column Name (key) of the Collection to extract value by Name as string

Hi all,

an example I will demonstrate for automating an email and getting collection from email headres. I am using GET IMAP actvity to get list of emails. Via the command email.headers I get collection (System.Net.Mail.Message) for each email.

If I want to loop through collection, I am using simply For Each activity and in it assign activity variableName=collection(indexNumber). Issue which I am facing, that by extracting data by index, I do not know exactly what value I have gotten. I know for instance that the Message ID can be used with command collection(“Message-ID”). So is there any way to get the name of all the keys (like “Message_ID”) that the collection contains, for example, write a collection to Excel. But I dont know how to do it either.

Thanks for all replies and ideas.