How To Setup SharePoint Integration: Model-Driven Power Apps

How To Setup SharePoint Integration: Model-Driven Power Apps

A SharePoint document library is often the better choice for storing files in an app vs. Dataverse file storage. The cost of SharePoint file storage is much cheaper ($0.20/GB vs $40/GB), it has versioning built-in and you can take advantage of tagging/metadata among other things. Fortunately, we can use SharePoint to store the files for any table in a model-driven app. In this article I will show you how to enable the SharePoint integration for model-driven Power Apps.

Table of Contents
• Introduction: The Project Tracker Model-Driven AppCreate A New Model-Driven AppProvision A New SharePoint Team SiteNavigate To The Advanced Settings MenuEnable The SharePoint Integration With The Model-Driven AppChoose Which Tables Use A SharePoint Document LibraryUpload A File Using The Document Associated GridDisplay The SharePoint Document Library On A Main Form Tab




Introduction: The Project Tracker Model-Driven App

Employees at a construction firm use the Project Tracker model driven app to keep important documents organized. The documents are displayed in a sub-grid and are stored inside of a SharePoint document library.




Create A New Model-Driven App

Open the Power Apps maker portal and add a new table named Project with the following columns:

  • Name (text)
  • Description (text)
  • City (text)
  • State (text)
  • Contract Amount (currency)


Populate the Projects table with this data:

NameDescriptionCityStateContract Amount
2023-001Office Tower 123 River Ave.AlbanyNY13,500,000
2023-002Strip Mall 1st St. N.NewarkNJ2,300,000
2023-003Big Box Store 734 Thames StPittsburghPA1,700,000
2023-004Office Building 789 Reading Ave.New YorkNY89,00,000
2023-005Condo Tower 1003 Main St.ChicagoIL5,600,000



Update the Main View of the Projects table to look like the view below:



And modify the Main Form to look like this form.




Provision A New SharePoint Team Site

We need to setup a new SharePoint site where the model-driven app will store its documents. Create a new SharePoint Team site. No other configuration is required here. When we setup the SharePoint integration with the model-driven app it will be done automatically for us.

Now we are ready to connect our SharePoint site to the model-driven app. Go back to Power Apps and click on the gear icon in the top-right corner. Choose Advanced Settings.



Then select System > Document Management.



The Document Management settings menu looks like this.




Enable The SharePoint Integration With The Model-Driven App

Next we will turn on the SharePoint integration with Power Apps. Select Enable Server-Based SharePoint Integration.

Navigate past the first screen of the setup wizard.



Choose Online on the Define Deployment screen.



Supply the URL of the SharePoint site we created and press the Next button.



Wait for the site to become validated. Then press Enable.



A success message will appear once the integration is enabled.




Choose Which Tables Use A SharePoint Document Library

We must define which tables in our model-driven app require a SharePoint document library. One document library will be setup per table. To do this, open the Document Management Settings from the Advanced Settings menu.



Select the Project table. This example uses only one table. But we do have the ability select more than one table if needed.



Select Next on this screen. Do not enable Based On Entity unless you are using the Account or Contact tables.



At this point the SharePoint document library will be created automatically by the integration. Wait for the process to complete.



After the the process is done we see the document library creation status page. The status should read succeeded. Press Finish.




Upload A File Using The Document Associated Grid

We can now use the model-driven app to store documents in SharePoint. Open a the main form of any record in the Project table. Navigate to the related Documents table.



The Document Associated Grid appears. Choose Upload.



Choose a file to upload and press OK.



The uploaded file appears in the grid.




Locate The Uploaded Document In SharePoint

The document we uploaded in the model-driven app is stored in a SharePoint document library. Let’s go find the document in SharePoint to understand more about the file structure being created behind the scenes.

Open the SharePoint site and go to Site Contents. Navigate to the Project folder.



Inside the Project folder there will be one subfolder for each Project record. Open the folder that matches the project we uploaded the document to.



Inside the folder we can see the uploaded file.




Display The SharePoint Document Library On A Main Form Tab

It is not ideal to make model-driven app users go searching for the Documents table within the Related tab. We can make is easier for them by showing Documents on their own main form tab.

Edit the main form of the Project table. Add a new 1 column tab named Document to the form. Insert a subgrid into the first section. Check the show related records box, choose the Documents table and use the All SharePoint Document default view.



Then Save & Publish. Ignore the warning message on the subgrid. It only appears in the editor.



When we open the model-driven app and go to the Documents tab the subgrid displays our documents.





Questions?

If you have any questions or feedback about How To Setup SharePoint Integration: Model-Driven Power Apps please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

16 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Dan Barrett
Dan Barrett
2 months ago

Thank you for another great blog post, the detailed step by step descriptions is super useful.

Are there any considerations or drawbacks using ALM with this setup?

Cheers

Dan

Matt Schuessler
Matt Schuessler
2 months ago

Hey Matthew! Great post as usual. Does the functionality break for you when you toggle the “Try the new look” feature in the top bar of the MDA? If yes, I think MS may have broken something. As an MVP, maybe you can let them know. Matt

Sam
Sam
2 months ago

Excellent blog as usual. Thanks Matthew!
A quick question: Can we upload multiple files for each Project table record or it is 1 file per record only?

Andrew Yoder
Andrew Yoder
2 months ago

Hi Matthew – Glad to see you’re doing all these posts on Sharepoint integrations. I wrote a similar 6-part series of some other techniques you may find interesting. In my experience, this type of thing is one of the most commonly requested functionalities.
Modern File Storage for the Power Platform (Part 1): Meta Data Tagging (mibar.net)

Raj
Raj
2 months ago

Hi Matthew, amazing post!

I was wondering if there was a way to visualise this SharePoint library items within model driven table using canvas app integration?

Brett
Brett
2 months ago

Thanks! Any strategies or methodologies to use power automate for more advanced document management than just one folder per record within the synced document library. Or to auto update meta data based on the record context and move files using PA.

Basically I am trying to figure out the best way to blend model driven apps and sharepoint integratiom, one team site per project, and management of projects team sites and do portfolio mgmt from the model driven app. However it would be nice to access the folder structure of the team site from the model driven app, not the auto created folder when syncing sharepoint to model driven apps natively.

Rafa
Rafa
2 months ago

Hi Matthew, thank you for all your blogs, I really appreciate them! I’m curious as to what’s your strategy to have a more “user-friendly” folder name in SharePoint… I usually use Power Automate to create the folder with a unique name (but “readable”) and the correspondent Document Locations record.

My trigger is usually the moment the Dataverse record is created, so that users without access to the Power App (or those accessing directly the SharePoint site) can load files from the very start, but I’m keen on learning your thoughts!

Another topic is accessing these files from a Canvas… but that’s for another post!

Cheers mate 🙂

Alice
Alice
1 month ago

Hey Matt,

Thanks for a great article, as usual!
I was wondering if you have any advice to do multiple files in a single upload (sorry if this is something you have already covered).

Thanks,

Alice

Salil
Salil
24 days ago

Fantastic solution. One question – is there a way to store documents in a specific folder in the document library or does it only store the way you showed in this blog?

Anjali
Anjali
11 days ago

Hi ,
Is there a way to see the version history and the share option within the grid itself when select the document we can see the version history and the share option. when we add the document grid the “”folder” option is not there , can we add in the grid itself, rather then select documents option under the related tab. Kindly help in these that we would great help.