Manage Attachments Of SharePoint On-Premises List Item

In Power Apps, through an on-premises data gateway, we can establish connections with SharePoint On-Premises servers like 2013, 2016, and 2019 and can connect to SharePoint OnPremise Lists.

But there is one problem.

SharePoint On-Premises List Item's "Attachments" field is not supported in Power Apps forms. Whereas the "Attachments" field is supported with SharePoint Online Lists.

There is an idea posted here in the MS Power Apps community portal. But this feature is not yet available.

Meanwhile, to address this problem, I worked on one custom "Attachment sync solution" which I hope will help many of you who are struggling with this problem.

Though SP On-Premises List "Attachments" field is not supported in Power Apps, it is supported in Power Automate.

So, the idea is, using two separate Power Automate flows, we will sync attachments from the "SharePoint OnPremise" List Item to the "SharePoint Online" List Item and vice versa.

This process diagram will help you to understand the "Attachment Sync Solution".

Manage Attachments of SharePoint On-Premises List Item

Image – Process Diagram

Let's go through steps one by one to implement this process and show "SharePoint 2016 (OnPremise) List Item attachments" on Power Apps.

Step 1. Create a test list (named "testlist") in SharePoint 2016 (or any SharePoint OnPremise server, 2013/2016/2019) as mentioned in the below Image.

Manage Attachments of SharePoint On-Premises List Item

Step 2. Enable Attachments on the test list from Advanced settings.

Manage Attachments of SharePoint On-Premises List Item

Step 3. Add sample data to the test list.

Manage Attachments of SharePoint On-Premises List Item

Step 4. Create a test list in SharePoint Online (named "SharePoint 2016 List Items Attachments")

Note: This SP Online list will hold Attachments for "SharePoint 2016 List Item", where SP 2016 list item ID will be stored in the Title column. Attachments (for specific SP 2016 list item) from this SP Online list will be shown on the Power Apps screen.

Manage Attachments of SharePoint On-Premises List Item

Step 5. Enable Attachments in this SP Online list.

Manage Attachments of SharePoint On-Premises List Item

Step 6. Data in the SP Online list will look like this when it is updated by 2 Sync Flows, which we will discuss in the following steps.

Manage Attachments of SharePoint On-Premises List Item

Step 7. Create On-Premises Data Gateway and SharePoint Connections.

Open Power Apps or Power Automate Portal.

Create SharePoint Online Connection.

Create SharePoint 2016 (OnPremise) Connection using SharePoint On-Premises Data Gateway.

Detailed steps are mentioned here in MS documents about how to create a connection with On-Premise Data Gateway.

Manage Attachments of SharePoint On-Premises List Item

Step 8. Attachment Sync - Flow 1 (From SP 2016 to SP Online list item)

Type: Automated Flow

Trigger: When an item is created or modified (SharePoint)

Connection: SharePoint On-Premises Data Gateway Connection

Please carefully review each step mentioned in the below Image, and you will understand how it is implemented. It is straightforward.

In short, it gets attachments from SP 2016 list item and stores in the SP Online list item.

  • If an item already exists in the SP Online list, then delete all attachments from the SP Online list item and add attachments to the existing SP Online list item.
  • If an item does not exist in the SP Online list, then create an SP Online list item and add attachments to that newly created item in the SP Online list.

Manage Attachments of SharePoint On-Premises List Item

Step 9. Attachment Sync - Flow 2 (From SP Online to SP 2016 list item)

Type: Automated Flow

Trigger: When an item is created or modified (SharePoint)

Connection: SharePoint Online Connection

Please carefully review each step mentioned in the below Image, and you will understand how it is implemented. It is straightforward.

In short, it gets attachments from the SP Online list item and stores them in the SP 2016 list item.

  • If an item already exists in the SP 2016 list, then delete all attachments from the SP 2016 list item and add attachments to the existing SP 2016 list item.
  • If an item does not exist in SP 2016 list, then terminate the flow. It might be that the list item is deleted from SP 2016 list.

Manage Attachments of SharePoint On-Premises List Item

Step 10. Create new Canvas Power Apps and add Connections

Open https://make.powerapps.com

Create new Canvas Power Apps.

Add SharePoint Online and SharePoint 2016 list connections.

Step 11. Select the "List" template from the "New screen" action to create a Browse Screen.

Manage Attachments of SharePoint On-Premises List Item

Step 12. Set Browse screen gallery with SP 2016 list items. Set the "OnSelect" and "Items" properties of the gallery as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 13. Select the "Form" template for the "Display Item, Edit Item, Display Attachments, Edit Attachments" screens as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 14. Set Display Form properties with SP 2016 list item as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 15. In the Display screen, Add the Attachment icon and set the "OnSelect" action in Display Screen as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 16. In the Display Attachments screen, set Display Attachment Form with the selected SP Online list item and show only the Attachment field. Please refer to the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 17. In the Display Form screen, set the Edit icon's "OnSelect" action as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 18. In the Edit screen, set Edit Form properties with SP 2016 list item as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 19. In the Edit screen, set Edit Form's "Item" property as an item selected from Gallery control (of Browse screen) with SP 2016 list item and Set DefaultMode as FormMode.Edit as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Step 20. In the Edit screen, set the "Attachment" icon's "OnSelect" action as mentioned in the below image. (Note: "New Form" case is also handled with Edit Form.)

Manage Attachments of SharePoint On-Premises List Item

Step 21. In the Edit Attachments screen, set Edit Attachment Form properties with selected SP Online list item and show only the Attachment field. Set Default Mode as FormMode.Edit. Please refer.

Manage Attachments of SharePoint On-Premises List Item

Step 22. In the Edit Attachments screen, set the "Accept" icon's "OnSelect" action as mentioned in the below image.

Manage Attachments of SharePoint On-Premises List Item

Done!

Now Save, Publish, and Run the Power Apps app in a new browser tab.

Attachments will be visible in Power Apps like this.

Manage Attachments of SharePoint On-Premises List Item

Manage Attachments of SharePoint On-Premises List Item

Happy Learning, Anywhere! J


Similar Articles