cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Manuel_P
Frequent Visitor

Get File Content From SharePoint with PowerApps

Hi.

 

My Scenario is:

I have an HTML-Template that I want to use within my PowerApp.

The PowerApp then shall replace placeholders within the HTML and store that "filled out" HTML Template to SharePoint.

 

I now want to store the initial HTML-Template within SharePoint so that e.g. users can update the HTML-Template in SharePoint and  the PowerApp pulls the new template without needing to update the App itself.

 

My question:

How can I read the HTML-file content from SharePoint with PowerApps?

What I have done:

- Create a DataSource Connection to target SharePoint library

- Fetch Document with LookUp-Function.

--> Okay, now I have got the file Properties, but do not know how to access the file content and store it in a local variable or field.

 

Any idea how I can achieve this?

 

I'm thankful for any help - :-).

Manuel

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Manuel_P :

I've made a test for your reference:

1\MY library:

vbofengmsft_0-1643867211747.png

vbofengmsft_3-1643867349101.png

 

2\Add a gallery and set it's items property to

library3

to show all files in this gallery

3\Create a flow:

vbofengmsft_1-1643867296946.png

vbofengmsft_2-1643867327215.png

4\insert the flow into the app

vbofengmsft_4-1643867375386.png

5\set the arrow's Onselect property to:

Set(TheHTMLText,Bof0203.Run(ThisItem.'Full Path').htmltext)

When the user clicks on this arrow, the HTML text of the current record will be stored in the variable 'TheHTMLText'

6\Add a HTMLtext control and set it's HtmlText property to:

TheHTMLText

vbofengmsft_5-1643867508487.png

Best Regards,

Bof

 

 

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @Manuel_P :

I've made a test for your reference:

1\MY library:

vbofengmsft_0-1643867211747.png

vbofengmsft_3-1643867349101.png

 

2\Add a gallery and set it's items property to

library3

to show all files in this gallery

3\Create a flow:

vbofengmsft_1-1643867296946.png

vbofengmsft_2-1643867327215.png

4\insert the flow into the app

vbofengmsft_4-1643867375386.png

5\set the arrow's Onselect property to:

Set(TheHTMLText,Bof0203.Run(ThisItem.'Full Path').htmltext)

When the user clicks on this arrow, the HTML text of the current record will be stored in the variable 'TheHTMLText'

6\Add a HTMLtext control and set it's HtmlText property to:

TheHTMLText

vbofengmsft_5-1643867508487.png

Best Regards,

Bof

 

 

Manuel_P
Frequent Visitor

Hi @v-bofeng-msft,

 

Thank you for your respond.

I guess that works.

 

But is it really the intention to start an "asynchronous" workflow to fetch data from a data source?

For me as a classic developer this does not feel right. 

I rather would prefer a get-call/webservice call or so.

I know this is a basic question of how to fetch data in software development but isn't there some other way of doing this?

Are there good arguments of why to do it with a workflow rather than: "it's the only workaround available for this scenario"?

 

Looking forward to your reply.

Best regards.

Manuel

Hi @Manuel_P :

   In fact, I can't tell you that's the only workaround ,but using flow is the most convenient way I can think of right now, because the actions in flow are actually encapsulated APIs, which are usually very stable and easy to use.

   If you want to implement it by calling web service, you need to find a related SharePoint API (this is beyond the scope of this forum), and create a custom connector to call this API (the API can not be called directly in the Canvas app, you need to call a API by creating a custom connector).

  Best Regards,

  Bof

  

I am currently attempting to use this flow to display the contents of HTML files in my Documents Library from SharePoint, however I am having issues.

 

To start, I have two files in my Library at the moment as seen below.

Lee_Morgan_0-1659733893858.png

Here is the flow I have:

Lee_Morgan_1-1659734045891.png

 

In the OnSelect option for the gallery, I am putting this formula in with no luck.

Lee_Morgan_2-1659734106814.png

 

 

What I would like it to do it set the file contents of the file selected in the gallery, and also navigate to Screen2 where the HTML text box is located and display the contents of the selected HTML file on Screen2. Thanks in advance for your help.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Top Solution Authors
Users online (2,448)