Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

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

Posted on by 361

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
    WarrenBelz 143,532 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    @Sormick ,

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

  • Verified answer
    Sormick Profile Picture
    Sormick 361 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    Finally i found what is causing this issue.

    This only works with variables but not with labels text.

    Now it works!

  • WarrenBelz Profile Picture
    WarrenBelz 143,532 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    @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
     }
     }
     )
    )
  • Sormick Profile Picture
    Sormick 361 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    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
    WarrenBelz 143,532 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    @Sormick ,

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

  • Sormick Profile Picture
    Sormick 361 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

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

  • Sormick Profile Picture
    Sormick 361 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    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.

     

     

  • WarrenBelz Profile Picture
    WarrenBelz 143,532 on at
    Re: contentBytes:PDF attachment on sharepoint does not work with label.text

    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

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard