Send Outlook Message: Given key was not present in the dictionary error

I came across an error concerning my dictionary. Would anyone happen to know what’s the cause of this error by any chance? I used a Config file using Excel to define some standard email variable such as Subject and Body. I then get an error telling me that “Send Outlook Mail Message: The given key was not present in the dictionary”. I checked for spaces but it all seems fine?



Config.xlsx (10.1 KB)

Hi @kerri.tiam2

I have the checked the config.xlsx the subject_Message is not present it was subject…

Change config(“subject_Message”).tostring to config(“subject”).tostring


Hi @prasath_S , sorry that was my mistake when uploading the screenshot. I did change it to Config(“Subject”).ToString but it’s still producing the same error

because you keep re-initializing the Config dictionary in each iteration of foreach, this assign should be BEFORE the “for each row” sequence, NOT inside it


like this


Thanks @jack.chan ! That fixed it! :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.