web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Engage with the Community
Answered

variables creation for email body

(2) ShareShare
ReportReport
Posted on by 33

Hello guys,

I need to declare a variable in PowerApps, I am doing the following and DAX syntax does not allow it:

Set(

    EmailBody;

    "<p>Text of my variable</p>"

);;



Office365Outlook.SendEmailV2(

    PeopleAddedGallery4.Selected.Mail;

    "EMAIL Subject";

    EmailBody;

    { IsHtml: true }

)

 

for the Set expression gives the error: invalid number of arguments received 1, expects 2.

 

Thanks in advance.

I have the same question (0)
  • Verified answer
    Vish WR Profile Picture
    1,043 on at

    This isn't a DAX issue — Power Apps uses its own formula language, not DAX.

    The problem is the semicolons as argument separators. In most Power Apps environments the delimiter is a comma, not a semicolon. So your Set() is being read as one argument instead of two, hence that error.

    You could try this 
     

    Set(EmailBody, "<p>Text of my variable</p>")

    Office365Outlook.SendEmailV2(

    PeopleAddedGallery4.Selected.Mail,

    "EMAIL Subject",

    EmailBody,

    { IsHtml: true }

    )


    Note : 

    Also drop the ;; double semicolons — those aren't needed in Power Apps at all.

    If your tenant is set to a locale that uses semicolons as separators (some European regions do), then semicolons would be correct and the issue is something else — but the comma version is worth trying first

     

     
     
      Vishnu WR
     
    Please âœ… Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like â™¥
     
     
     
  • MR-30031723-0 Profile Picture
    33 on at
    @Vish WR thank for your proper reply, I would like to know all the details for the PowerApp language acording my region settings(do you know where to find those specifications?) Thank you very much your answer really helped me with the issue I was having. Still my sentence in the section: 
    Office365Outlook.SendEmailV2(
    PeopleAddedGallery4.Selected.Mail,
    "EMAIL Subject",
    EmailBody,
    { IsHtml: true }
    )
    It highlights the Office365Outlook.SendEmailV2 function and the comma right after the Mail argument, and it throws the error message:

    "Unexpected characters. The formula contains a 'Comma' where 'ParenClose' is expected."

    The arguments look correct to me, so what could be the problem?
     
     
    Thank you once again, 
    Manuel Rivera
  • Verified answer
    Vish WR Profile Picture
    1,043 on at
  • MR-30031723-0 Profile Picture
    33 on at

    I am stuck with an expected operator error in PowerFx and I cannot move forward.

    Considering that my first expression works correctly using commas, I assume that my argument delimiter should still be a comma.

    For example, this works without issues:

     

    Set(EmailBody, "<p>Text of my variable</p>")

     

    However, when I try to send the email using Office365Outlook.SendEmailV2 with all the arguments defined, I get the following error:

    "Expected an operator such as +, * or & at this point of the formula"

    This is the code I am using:


    Office365Outlook.SendEmailV2(
    PeopleAddedGallery4.Selected.Mail;
    "EMAIL Subject";
    EmailBody;
    {
    IsHtml: true
    // Attachments:
    // ForAll(
    // AttachmentsControl1.Attachments;
    // {
    // Name: ThisRecord.Name;
    // ContentBytes: ThisRecord.Value
    // }
    // )
    };
    )

     

    No matter what I try, I cannot get past this error.
    My goal is to be able to send the email with all these arguments properly defined, including HTML body and attachments.

    What am I doing wrong with the argument delimiters or the function syntax?

  • Vish WR Profile Picture
    1,043 on at
    Can you see if this works?
     
     
    Office365Outlook.SendEmailV2(
    PeopleAddedGallery4.Selected.Mail,
    "EMAIL Subject",
    EmailBody,
    {
    IsHtml: true,
    Attachments:
    ForAll(
    AttachmentsControl1.Attachments,
    {
    Name: ThisRecord.Name,
    ContentBytes: ThisRecord.Value
    }
    )
    }
    )


     
  • MR-30031723-0 Profile Picture
    33 on at
    still the same error in the underlined line ("Expected an operator such as +, * or & at this point of the formula")
  • Vish WR Profile Picture
    1,043 on at
    Office365Outlook.SendEmailV2(
        PeopleAddedGallery4.Selected.Mail,
        "EMAIL Subject",
        EmailBody,
        {
            IsHtml: true,
            Attachments:
            ForAll(
                AttachmentsControl1.Attachments,
                {
                    Name: ThisRecord.Name,
                    ContentBytes: ThisRecord.Value
                }
            )
        }
    )
  • MR-30031723-0 Profile Picture
    33 on at
    Thank you for swearing with me looking for the solution. 

    I found the solution:

     

    Set(EmailBody, "<p>Text of my variable</p>"); <-- this semicolon was missing

     

    Office365Outlook.SendEmailV2(

    PeopleAddedGallery4.Selected.Mail,

    "EMAIL Subject",

    EmailBody,

    { IsHtml: true }

    )

     
    the semicolon after the first expression was missing. I almost died on the way.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Engage with the Community

#1
Vish WR Profile Picture

Vish WR 89

#2
MR-30031723-0 Profile Picture

MR-30031723-0 30

#3
Sunil Kumar Pashikanti Profile Picture

Sunil Kumar Pashikanti 13 Moderator

Last 30 days Overall leaderboard