GSuite Send Email Message, how to assign for input property "To:"

Tried to Read Range from Gsheet > For Each Row in dt > Send Email Message
To: (mailto) Variable String
How should I Assign Value for mailto to get the email stored in Gsheet row(3) ?
Tried row(3).ToString but got error "Cannot assign from type ‘System.String’ to type ‘System.String’ in Assign activity ‘Assign’.
Thanks

Fine

may i know why we are trying to use string array variable in TO property
are we trying to send to many recipients
Cheers @MubieSam_Lin

Learned from GSuite - Send Email Message
In the Send Mail Message activity, the To property should be array of string variable not a string variable, because To property accepts list of recipients.

1 Like

Fine
do we have more than one recipient in the string array variable
Cheers @MubieSam_Lin

not for this case
If only one recipient for my use case, what should be the Variable type and how to assign?
Thanks

1 Like

then we need to assign that ro(3) value to a string array variable using ADD TO COLLECTIONS activity
–create a list string variable named list_recipients with default value of New list(of string) defined in the variable panel
–now use a add to collection inside the for each row loop where you are fetching the row value
–in the property panel, in collections mention as list_recipients and in items mention as row(3).tostring and change the type argument as string in the property panel of add to collections

–now use this list_recipients.ToArray() in the TO property of that send mail activity

Cheers @MubieSam_Lin

1 Like

–create a list string variable ? Which one?
System.Collections.Generic.List got Error “Not all generic types could be resolved.”

Fine
we need to create a list variable in the variable panel of type
system.collections.generic.list(of string)
with default value in the variable panel as new list(of string)
and name the variable name as list_recipients

Cheers @MubieSam_Lin

Can not find system.collections.generic.list(of string) in the variable panel of type
Only system.collections.generic.list but got Error “Not all generic types could be resolved.”

1 Like

Fine


Cheers @MubieSam_Lin

1 Like

Sorry, my bad

1 Like

no worries
so did that work buddy
Cheers @MubieSam_Lin

Collection list_recipients Error "Compiler error(s) encountered processing expression “list_recipients”. Option Strict On not allow from ‘System.Collections.Generic.List(Of String)’ to ‘System.Collections.Generic.ICollection(Of System.Activities.Statements.AddToCollection(Of String))’

Item row(3).ToString Error ""Compiler error(s) encountered processing expression “row(3).ToString”.
Type ‘String’ value can not convert to ‘System.Activities.Statements.AddToCollection(Of String)’.

1 Like

kindly share a screenshot of add to collections property panel
Cheers @MubieSam_Lin

change the type argument as string in the property panel of this add to collections
Cheers @MubieSam_Lin

1 Like

the error disappeared, test run OK, big thanks @Palaniyappan

No worries
Cheers @MubieSam_Lin

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