Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Help with this error. method 'SendEmailV2' has an invalid value for parameter 'To'

So i have a label which the email refers to but now for some reason it is throwing this error. Office365Outlook.SendEmailV2(Label4.Text,"A Learning request has been lodged") And in the label4, I have a series of nested ifs like this: If(DataCardValue3.Selected.Value = "Coaching Request", "phil.mack@email.com.au", If(DataCardValue3.Selected.Value = "Training Request", "phil.mack@email.com.au", If(DataCardValue3.Selected.Value = "General Request", "phil.mack@email.com.au"))) Any ideas on what I am doing wrong?

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Yeah so the fix was just having the one if in the label so Wearsky you da champ!

Syndicate_Admin
Administrator
Administrator

Are there any instances where Label4.Text is blank? A blank 'To' parameter of the SendEmailV2 action would cause an error.

You can extend a Switch statement to have a default value if no other clauses are met. I should have added it previously, apologies.

Switch(DataCardValue3.Selected.Value,
"Coaching Request", "phil.mack@email.com.au",
"Training Request", "phil.mack@email.com.au",
"General Request", "phil.mack@email.com.au",
"phil.mack@email.com.au")


Else, feel free to post an image of the error and will see if I can help further.

Syndicate_Admin
Administrator
Administrator

I've change the label to Switch as mentioned above but it is still throwing the error.

 

method 'SendEmailV2' has an invalid value for parameter 'To' below is the code that it is outlining as the issue.

 

Office365Outlook.SendEmailV2(Label4.Text,"A Learning request has been lodged")

Syndicate_Admin
Administrator
Administrator

I'd agree with @v-xiaochen-msft's suggestion but streamline the if statement in Label4 to use a Switch instead - especially if you have to add more scenario's in future

Switch(DataCardValue3.Selected.Value,
"Coaching Request", "phil.mack@email.com.au",
"Training Request", "phil.mack@email.com.au",
"General Request", "phil.mack@email.com.au")
Syndicate_Admin
Administrator
Administrator

Hi @Philmack ,

 

Please try this:

If(!IsBlank(DataCardValue3.Selected), Office365Outlook.SendEmailV2(Label4.Text,"A Learning request has been lodged") )


And in the label4, I have a series of nested ifs like this: If(DataCardValue3.Selected.Value = "Coaching Request", "phil.mack@email.com.au", "Training Request", "phil.mack@email.com.au",  "General Request", "phil.mack@email.com.au")

 

Best Regards,

Wearsky

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.