cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoeEllis
New Member

Error with Office365Outlook.SendEmailV2() Invalid value for "to" parameter

Hey there, I'm having an issue with an app we created about a year ago, it's been functioning fine until recently, where we have been getting the "Office365Outlook.SendEmailV2() Invalid value for "to" parameter" error. The email does fail to send as it states. I'm not sure if anyone else is seeing this issue, or if some Microsoft change has happened to this function. Below is the code we have been using.

 

If(
DataCardValue45.Selected.Value = "removed",
Office365Outlook.SendEmailV2(
If(
DataCardValue5.Selected.Value = "removed2",
"user1@domain.com",
If(
DataCardValue5.Selected.Value = "removed3",
"user2@domain.com"
)
),
"New D365 Item Number Generated: " & DataCardValue1,
"A new D365 Item Number has been generated, " & DataCardValue1 & ". Please continue the process.",
{Cc: "user@domain.com"}
),
Office365Outlook.SendEmailV2(
If(
DataCardValue5.Selected.Value = "removed",
"user1@domain.com",
If(
DataCardValue5.Selected.Value = "removed2",
"user2@domain.com"
)
),
"New D365 Item Number Generated: " & DataCardValue1,
"A new D365 Item Number has been generated, " & DataCardValue1 & ". Please continue the process.",
{Cc: "user@domain.com"}
)
);
SubmitForm(Form1);
Back()

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @JoeEllis ,

Try shifting the logic outside the outlook code

With(
   {
      wUser:
      Switch(
         DataCardValue5.Selected.Value,
         "removed2",
         "user1@domain.com",
         "removed3",
         "user2@domain.com"
      )
   },
   If(
      DataCardValue45.Selected.Value = "removed",
      Office365Outlook.SendEmailV2(
         wUser,
         "New D365 Item Number Generated: " & DataCardValue1,
         "A new D365 Item Number has been generated, " & DataCardValue1 & ". Please continue the process.",
         {Cc: "user@domain.com"}
      )
   )
);
SubmitForm(Form1);
Back()

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @JoeEllis ,

Try shifting the logic outside the outlook code

With(
   {
      wUser:
      Switch(
         DataCardValue5.Selected.Value,
         "removed2",
         "user1@domain.com",
         "removed3",
         "user2@domain.com"
      )
   },
   If(
      DataCardValue45.Selected.Value = "removed",
      Office365Outlook.SendEmailV2(
         wUser,
         "New D365 Item Number Generated: " & DataCardValue1,
         "A new D365 Item Number has been generated, " & DataCardValue1 & ". Please continue the process.",
         {Cc: "user@domain.com"}
      )
   )
);
SubmitForm(Form1);
Back()

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

JoeEllis
New Member

That worked great, thank you!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,232)