Hi, I need to retrieve the keys and values stored in a dictionary variable in a outlook mail. For example, I have this dictionary:
Dictionary = {“748201” = "Invoice Tech Department"´}
{“753921” = "Invoice Marketing Department"´}
{“776201” = "Invoice blabla Department"´}
And i want to put something like this in a single email:
The code 748201 of Invoice Tech Department
The code 753921 of Invoice Marketing Department
(…)
How can I send a single Email with all the information of the dictionary?
ppr
(Peter Preuss)
September 26, 2023, 12:22pm
2
As mentioned here:
myDict | DataType: Dictionary(Of String, String) =
new Dictionary(Of String, String) From{
{"748201","Invoice Tech Department"},
{"753921","Invoice Marketing Department"},
{"776201","Invoice blabla Department"}
}
For more manipulation / accessing options have a look here as well:
One Of Many Options:
String.Join("<br>", myDict.Select(Function (x) String.Format("{0}:{1}", x.Key, x.Value))
We assumed, that the email will be sent as HtmlText, so we used <br> for the line break
String.Join("<br>", myDict.Select(Function (x) String.Format("The code {0} of {1}",x.Key, x.Value))
1 Like
And if i don’t wanna use html? Because i’m using the body of the outlook email activitie
ppr
(Peter Preuss)
September 26, 2023, 12:25pm
4
this is what we adressed above:
When body is isHtmlBody:
String.Join("<br>", myDict.Select(Function (x) String.Format("The code {0} of {1}",x.Key, x.Value))
When Body is PlainText
String.Join(Environment.NewLine, myDict.Select(Function (x) String.Format("The code {0} of {1}",x.Key, x.Value))
Hi @Carla_Munoz
you can try this way
xaml : - Dictionarie to mail.zip (1.8 KB)
you can see the expected out : -
note while sending to mail in the mail body you can use like this
emailBody.ToString()
1 Like
you can try that hope it will help for you
let me know anything else
@Carla_Munoz
@ppr what the “x” means? sorry hahaha
ppr
(Peter Preuss)
September 26, 2023, 12:44pm
8
its like a temporary variable:
This woooorks!! thank you so much
1 Like
system
(system)
Closed
September 29, 2023, 1:13pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.