I am trying to build a list of Dictionary’s based off of emails
I set a Dictionary value like this New Dictionary(Of String, String) from {{“Sender”, CurrentEmail.Sender}, {“Subject”, CurrentMail.Subject}, {“Date”, CurrentMail.Date}}.
That is working
When I loop through the dictionary it prints the values fine using Message Box so I know the right values are being set.
Now I am trying to figure out how to Append that Dictionary to a List. And Everything I try just errors out
I only have access to Studio X presently, as that is all my company will approve of
First, you need to initialize a list to store the dictionaries. This can be done using the Assign activity:
MyList = New List(Of Dictionary(Of String, String))()
Where `MyList` is a variable of type `List(Of Dictionary(Of String, String))`.
2. **Create a Dictionary:**
* In the process where you're fetching email data, create the dictionary for each email, as you already did:
New Dictionary(Of String, String) From {{"Sender", CurrentMail.Sender}, {"Subject", CurrentMail.Subject}, {"Date", CurrentMail.Date}}
Append Dictionary to List:
Use the Add to Collection activity to append the dictionary to your list:
Set the Collection to your list variable (MyList).
Set the Item to your dictionary (which contains the email data).
Ensure that the TypeArgument is set to Dictionary(Of String, String).
Loop Through Emails:
Inside the loop where you iterate through emails, you can repeat the above steps to append each email’s dictionary to the list.
This method allows you to append the dictionary without modifying the original list or encountering errors.