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 :
Power Platform Community / Forums / Power Apps / Remove last letter fro...
Power Apps
Unanswered

Remove last letter from Concat and send mail with attachment not working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have two issues below that I am trying to resolve. Any helps would be appreciated. 

 

1. I used the formula below to concat the filenames of attachments, but I would like to remove the & at the end. 

 

Concat(DataCardValue57.Attachments,Name & " & ")

 

atn2023_0-1688407390443.png

 

2. I use the formula below to send email with attachments but is not working. The error message is "Invalid number of arguments: Received 5, expected 3-4"

 

Office365Outlook.SendEmailV2( To1_2.Text, Subject1_2.Text,RichTextEditor1, {Cc: CC1_2.Text}, {Attachments: AddColumns(RenameColumns(DataCardValue57.Attachments,"Value","ContentBytes"),"@0data.type","")})

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi

    Plz try this formulas it may help you

    Formula 1:

    Concat( LastN( DataCardValue57.Attachments,

    CountRows(DataCardValue57.Attachments) - 1 ), Name, ", " ) &

    Last(DataCardValue57.Attachments).Name

     

    Formula 2:

    Office365Outlook.SendEmailV2( To1_2.Text, Subject1_2.Text, RichTextEditor1.HtmlText,

    {Attachments: AddColumns(RenameColumns

    (DataCardValue57.Attachments,"Value","ContentBytes"),

    "@odata.type","")} )

    Thanks!

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the response but unfortunately i encountered errors below 

     

    1. The value returns duplicate last attachment filenames. 

     

    atn2023_0-1688448735124.png

    atn2023_1-1688448747169.png

     

    2. I added the formula and the error is gone but it seems the formula exclude the CC. Is there a way to include CC in it? 

     

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi,

    1.To avoid duplicate last attachment filenames, you can use the Distinct function.

    2.

                     Office365Outlook.SendEmailV2(
                           {
                               To: To1_2.Text,
                               Cc: CC1_2.Text,
                               Subject: Subject1_2.Text,
                                Body: RichTextEditor1.Text,
                               Attachments: AddColumns(
                               RenameColumns(
                               DataCardValue57.Attachments,
                              "Value",
                              "ContentBytes"
                           ),
                             "@odata.type",
                                ""
                           )
                      }
    )

     

    Thanks!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks but I get the error below

     

    1. The formula below does not grab the first attached file name and instead duplicates the filename of second attached file. So I am not sure how distinct will work on this. 

     

    2. I get the error below for the revised forumulas

    atn2023_0-1688569662037.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I used the formula below and it grabs all the filenames without duplicates 

     

    Concat(LastN( DataCardValue57.Attachments,CountRows(DataCardValue57.Attachments) +1 ), Name, ", " )

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard