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

49 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Dan Barrett
Dan Barrett
11 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

Mac
Mac
6 months ago

Will this mean creating 3 separate document libraries in SP, one for each environment? Have confirmed this method works in the dev env (thanks Matt!) but now considering the client SP infrastructure and if the 3 separate libraries (Dev, Test and Production) will be needed. Thanks in advance

Last edited 6 months ago by Mac
Damian
Damian
5 months ago

I think its only settings by tenant, not environment.

Matt Schuessler
Matt Schuessler
11 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
11 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
11 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)

Gavin
Gavin
1 day ago

FYI Andrew, I’m getting an error when I try to view your link above and even when I try to go to mibar.net

Raj
Raj
11 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
11 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
11 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 🙂

Marco
Marco
10 months ago

Hi Matthew, great post, very helpful (like the others for that matter)
I have been thinking about these issues for a long time and I have two questions:
1) Some documents need to be viewed only by some (e.g. payroll) while others can be viewed by all. is it possible to do this with Sharepoint / Model-Driven App integration?
2) Can I also use the integrated collection in a Canvas app as well as in a Model Driven app?

Always thank you for your work

Translated with DeepL.com (free version)

Albi
Albi
2 months ago

Hi Matthew,

2. Don’t you have more information on how to use Power Automate to read documents from SharePoint document libraries using the service account and response them to the canvas app?

Thanks,

Albi

Alice
Alice
10 months 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

Lawrence Duff
Lawrence Duff
9 months ago
Reply to  Alice

Or you could educate the user to click “Open Location” on the menu bar of the SharePoint library subgrid and that will open the corresponding SharePoint page. Then the user can knock themselves out with multiple uploads, folder creation, adding metadata to the SharePoint library, etc., in the SharePoint page.

Lawrence Duff
Lawrence Duff
9 months ago

Great post, thanks!

I’ve got an issue with the two views that appear on the subgrid when linked to the “Documents (Regarding)” table, as follows:

The “Document Associated Grid” – DAG for short – does not appear in the Default view property dropdown list of the subgrid. Only the “All SharePoint Document” view is listed in the dropdown – see attached image. So I can’t set the “DAG” as the default view.

I want the “DAG” view to be the default view in my custom “Documents” tab (like it is in the “Related Documents” tab called “Documents”) because the DAG view shows the folders and subfolders of the SharePoint document location with navigation up and down via breadcrumb trail, whereas the “All SharePoint Document” view does not.

How can I set the default view of the subgrid to the DAG?

DAGIssue.png
Salil
Salil
9 months 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?

Veerle S
Veerle S
7 months ago
Reply to  Salil

There are third party tools that let you configure how to structure the documents in SharePoint and you can also use Power Automate to create your own folders and Document Locations the way you like. Of course doing custom stuff like that comes with extra opportunities for bugs and future rework 😉

Anjali
Anjali
9 months 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.

David Cummins
David Cummins
8 months ago

Hi Matthew, thanks for this demo. Unfortunately, my version of Dataverse / Model Driven App does not support Advanced Settings, so no Document Managment option. Do you know of a work around or do I need my organization to upgrade. We currently are licensed for Power Apps / Model Driven Apps but I don’t know what upgrades we need to achieve the SharePoint integration.

Thanks!

Devon Aleshire
Devon Aleshire
8 months ago

I have a use case where we are using SharePoint integration in a model-driven app for document storage. One of the entities using documents are subcomponents where multiple subcomponents that are same model and version could have the same manufacturing guide, specs sheet, etc.

Is there a way, using SharePoint integration, to share a single document for multiple subcomponents and avoid duplicating the document and storing multiple copies for each item?

Great post and thank you!

Veerle S
Veerle S
7 months ago

I’m using document integration for multiple model driven apps on one environment.All apps have their own DEV environment. “IsDocumentManagementEnabled” seems to be the table metadata that defines whether this out of the box SharePoint document integration is active. It all went fine until with our latest solution which contains a shared table that has document integration enabled from a previous app but doesn’t need it in the new app. The tables metadata is not in this new solution (metadata of shared tables are only included in one global solution which also has it’s separate DEV environment), yet the shared table’s document integration gets turned off when I import the new solution. I have other solutions that also contain that same table without the metadata and they don’t interfere with the document integration.

CCA
CCA
7 months ago

I forgot to attach my screenshot. Here it is.

FlowDocument.png
Jane Wang
Jane Wang
7 months ago

Hi Matthew, first of all I’d like to express my gratitude for your such detailed show and tell article. It’s very helpful!! I followed your instruction, and everything went well except the last step of showing all associated files in the Documents tab. It pops out message saying, “Collaborate and share files easily-ask your admin to enable SharePoint.” Would you please advise me on this part? I have very limited knowledge of SharePoint. Much appreciated your help!!!

Jane Wang
Jane Wang
7 months ago

Sorry it’s me again, please ignore my last comments. I found out why. Thank you!

Jane Wang
Jane Wang
7 months ago

Hi Matthew, sorry to bother you again. In this documents table, is there a way to edit prosperities? When I select a file, go to the edit property, it only has two options: Name and Title. In fact, I created a column called document type and I’d like to have the document type shown in edit property dialog. Would you please share some light on this? Much appreciated your help.

Carlo Scampicchio
Carlo Scampicchio
7 months ago

Thank you, Dan for your excellent and clear description, but I have a question: usually I develop all my Apps in a developer environment and then I move them in a production environment by a managed solution. I have been using the same procedure you describe since man years, without any problem, but, since a few months I noticed that this procedure creates an “active” layer for each table where a SharePoint Doc Library is created. This is very annoying because it prevents future customization to be imported into those tables. What do you recommend solving this problem?