其他分享
首页 > 其他分享> > Manage SharePoint documents with PowerApps - Model-Driven Apps

Manage SharePoint documents with PowerApps - Model-Driven Apps

作者:互联网

 

Microsoft Dataverse supports integration with SharePoint Online that enables you to use the document management capabilities of SharePoint from within Dataverse. Power Apps portals now supports uploading and displaying documents to and from SharePoint directly on a basic form or advanced form in a portal. This allows portal users to view, download, add, and delete documents from a portal. Portal users can also create subfolders to organize their documents.

 Note

To work with the document management capabilities of SharePoint from within Dataverse, you must:

  1. Enable document management functionality for your environment

  2. Set up SharePoint integration from Power Apps portals admin center

  3. Enable document management for tables

  4. Configure the appropriate form in Power Apps documents

  5. Create appropriate table permission and assign it to the appropriate web role

Step 1: Enable document management functionality in model-driven apps

You must enable the document management functionality in model-driven apps by using server-based SharePoint integration. Server-based SharePoint integration allows model-driven apps and SharePoint Online to perform a server-to-server connection. The default SharePoint site record is used by the portal. For information on how to enable document management functionality in model-driven apps, see Set up model-driven apps to use SharePoint Online.

Step 2: Set up SharePoint integration from Power Apps portals admin center

To use the document management capabilities of SharePoint, you must enable SharePoint integration from the Power Apps portals admin center.

 Note

You must be a global administrator to perform this action.

  1. Open Power Apps portals admin center.

  2. Go to Set up SharePoint integration > Enable SharePoint integration.

    Enable SharePoint integration

  3. Select Enable in the confirmation window. This will enable the portal to communicate with SharePoint. While the SharePoint integration is being enabled, the portal restarts and will be unavailable for a few minutes. A message appears when SharePoint integration is enabled.

When SharePoint integration is enabled, the following action becomes available:

Enabling or disabling the SharePoint integration will update the Azure Active Directory (Azure AD) application for the portal and add or remove the required SharePoint permissions, respectively. You'll also be redirected to provide your consent for the changes to be made in the Azure AD application.

Disable SharePoint integration consent screen

If you don't provide your consent:

Step 3: Enable document management for tables

You must enable document management for tables to store documents related to table records in SharePoint. For information on how to enable document management for tables, see Enable SharePoint document management for specific tables.

Step 4: Configure the appropriate form to display documents

Power Apps customization

Identify the form where you want to use document management capabilities. You must edit the form by using model-driven app form editor and add a subgrid to it. The subgrid adds a section to the form, which allows you to work with documents from within a portal. You must set the following properties in the subgrid for this feature to work:

You can specify name and label as per your requirement. Save and publish the form once the subgrid is added and configured.

 Note

Document management must be enabled for the table for which you edit the form. More information: Enable document management for tables

Power Apps portals configuration

Apart from the standard configuration required for basic form or advanced form, you must set the following properties to enable document management:

 Note

Document uploading requires the parent table record to exist. If you set the Mode to Insert, the document upload will not work because the parent table record is not created until the form is submitted.

Step 5: Create appropriate table permission and assign it to the appropriate web role

Two table permission records are required to establish the necessary access to view and upload documents.

 Note

A corresponding child table permission on the Document Location table needs to be created for each instance of the parent table permission record that exists on the table of the table or advanced form where documents need to be shown.

Configure file upload size

By default, the file size is set to 10 MB. However, you can configure the file size to a maximum of 50 MB by using the site setting SharePoint/MaxUploadSize.

Maximum file download size

We recommend limiting the size of the individual files available for download to 250 MB or less. If you use portals to download larger files from SharePoint, the operation may timeout after a couple of minutes.

Sample configuration to enable document management on the Case basic form

The below example demonstrates configuration using the Case table which needs the Dynamics 365 Customer Service application as a pre-requisite. Although this sample uses the Case table, it is just an illustration of the steps mentioned above and can be followed with any other custom table or any Dataverse table that supports managing documents in SharePoint.

  1. Follow the instructions in Step 1 to ensure that server-based configuration is complete for your environment and SharePoint integration.

  2. Follow the instructions in Step 2 to ensure that the portal has permissions to integrate with SharePoint.

  3. Follow the instructions in Step 3 to ensure Document Management is enabled for the Case table.

  4. Follow the instructions in Step 4 with the following configurations:

    • Model-driven apps customization

      a. Go to Settings > Customization > Customize the System.

      b. In the Default Solution, go to the Case table > Forms.

      c. Open the Web – Edit Case in form editor.

      Web - Edit Case form

      d. Select the Created On field on the form, and on the Insert tab, select Sub-Grid.

      Add a subgrid to the Web - Edit Case form

      e. In the Set Properties dialog box, set the following properties, and select OK:

      • Name (This can be any name): CaseDocuments

      • Label (This can be any label name): Case Documents

      • Table: Document Locations

      • Default View: Active Document Locations

      Subgrid properties

      f. In the form editor, select Save and then select Publish.

    • Power Apps portals configuration

      a. Open Portal Management app -> Basic Forms.

      b. Find and open Customer Service - Edit Case basic form.

      c. Review and ensure the following properties are set:

      • Table Name: Case (incident)

      • Form Name: Web – Edit Case

      • Mode: Edit

      • Table Permission: Enabled

      d. If you’ve made any changes to the form, select Save.

  5. Follow Step 5 to make sure table permissions are granted to the users.

    1. Go to the Web Role record that is associated to the user. For this sample, we’ll assume that the user has an Administrator web role.

    2. Ensure that an Table Permission record exists by the name of Customer Service - Cases where contact is customer.

       Note

      Ensure that your web role has this table permission added. If your user is already an Administrator, then the above table permission need not be explicitly assigned.

    3. Create a new table permission, enter the following details, and select Save:

    • Name (This can be any name): Customer Service - Related Documents

    • Table Name: Document Location

    • Access Type: Parent

    • Parent Table Permission: Customer Service - Cases where contact is customer

    • Parent Relationship: incident_SharePointDocumentLocations

    • Privileges: Read, Create, Append, Write, Delete

    1. Sign in to portal to ensure document management is enabled for the Case table.

      a. Go to the Support page.

      Portal support page

      b. Select an existing Case record from the list. Go to the Case Documents section on the page and see the document list added.

      Case document

 

标签:PowerApps,Manage,form,SharePoint,integration,management,table,document
来源: https://www.cnblogs.com/lingdanglfw/p/14989103.html