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 / contentBytes:PDF attac...
Power Apps
Answered

contentBytes:PDF attachment on sharepoint does not work with label.text

(0) ShareShare
ReportReport
Posted on by 566

Hi,

I use this formula below to save PDF as attachment on a sharepoint list.

REPONSEBVPDF1.Run({file:{name:Label22.Text&".pdf";contentBytes:PDF(ReponseBV;{ExpandContainers:true})}})

But with this formula it only creates an element on my sharepoint list without save my PDF file as attachment.

if i replace on this formula Label22.Text&"pdf" by "test.pdf" the file is attached correctly to my sharepoint list.

The issue i have is that i need to get the text which is located to the Label22.Text on another screen

Categories:
  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @Sormick ,

    Is Label22 a calculated label ? If so maybe create a Variable with the calculation when whatever creates it is input and then use the Variable in the file name.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Sormick Profile Picture
    566 on at

    Please find here one the the variables i entered to the label.22.text:

    Set(SELECTEDTEXTE;DataTable1.Selected.'Grand Tag')

    If i add this variable! SELECTEDTEXTE to REPONSEBVPDF1.Run({file:{name:SELECTEDTEXTE&".pdf";contentBytes:PDF(ReponseBV;{ExpandContainers:true})}})

    the file is not added as attachment on the sharepoint list.

    this variable was added on the label22.text on the "text" field.

     

     

  • Sormick Profile Picture
    566 on at

    Hello, Any idea how to store my screen content as PDF file on a sharepoint list with filename from the Variable Above?

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @Sormick ,

    If you look in the Variable SELECTEDTEXTE (put it on a Label), do you see the file name ?

  • Sormick Profile Picture
    566 on at

    Hello,

    I confirm i can see the filename of the variable SELECTEDTEXTE on the label22.text

    On the sharepoint list i can see the filename on the new created record but the PDF file is not attached to this record.

    if  i replace this variable on REPONSEBVPDF1.Run({file:{name:SELECTEDTEXTE&".pdf";contentBytes:PDF(ReponseBV;{ExpandContainers:true})}}) to  REPONSEBVPDF1.Run({file:{name:"TEST.pdf";contentBytes:PDF(ReponseBV;{ExpandContainers:true})}}) now the PDF is added as attachment on my sharepoint list. 

    but i need to get the text on this variable. I don't know how to rectify this.

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @Sormick 

    OK - one last attempt as this is making no sense

    With(
     {
     _Name: SELECTEDTEXTE & ".pdf";
     _PDF: PDF(ReponseBV;{ExpandContainers:true})
     };
     REPONSEBVPDF1.Run(
     {
     file:
     {
     name: _Name;
     contentBytes: _PDF
     }
     }
     )
    )
  • Verified answer
    Sormick Profile Picture
    566 on at

    Finally i found what is causing this issue.

    This only works with variables but not with labels text.

    Now it works!

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @Sormick ,

    That is exactly what I tried to do with my last post - With() produces a temporary Variable

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard