How to migrate SharePoint Online SPWeb with custom SPList form (PowerApps) and Flows

Problem

I need to migrate a SPWeb with custom SPList form (PowerApps) within the same SPSite collection.

Solution

  1. Run the following PnP PowerShell command from Windows PowerShell ISE

    $TemplateFilePath = "C:\temp\PnPSiteTemplate_YourSourceFormSubsiteName.xml"

    $SourceSiteConnection = Connect-PnPOnline https://YourTenancy.sharepoint.com/sites/SharePointForms/PROD/YourSourceFormSubsiteName -Interactive

    Get-PnPSiteTemplate -Connection $SourceSiteConnection -PersistBrandingFiles -IncludeAllPages -Verbose -Out $TemplateFilePath

    $TargetSiteConnection = Connect-PnPOnline https://YourTenancy.sharepoint.com/sites/SharePointForms/PROD/YourTargetFormSubsiteName -Interactive

    Invoke-PnPSiteTemplate -Connection $TargetSiteConnection -Path $TemplateFilePath -ClearNavigation

    Disconnect-PnPOnline

  2. Ensure the target copied list is unmodified. Do not rename it or change it until the PowerApps are imported and republished to prevent Data Source confusion after import.

  3. Navigate to List settings | Forms | Version History

  4. Export the live version of PowerApps


  5. Open the exported .zip file and edit /Microsoft.PowerApps/apps/xxx.../xxx...JSON folder:
    Find and replace the site URL and list GUIDs with the target site URL and target list GUIDS (navigate to List settings and copy the list GUID on URL query string in between listedit.aspx?List=%7B and %7D).

  6. Open the exported .zip file and edit /manifest.json to replace the list GUID with target list GUID.

  7. Navigate to PowerApps | Apps | Import canvas app | Upload and select the modified .zip file. Remember to click the Action spanner icon and click Save before clicking Import to prevent error during import.



  8.  Navigate to target List settings | Form settings | Modify form in PowerApps and reconnect the Data Source with the target list(s) then republish the app. If there's any error when deleting/adding the target list(s), ensure the display list name is correct in case it has been renamed before originally.

  9. Manually check and fix Site groups, permission, list permission, site page content and permission, list items such as configurations.

  10. As for PowerAutomate Flow, export it to Package (.zip) file and edit the definition.json file. Replace any source SPWeb URL and List GUIDs with destination SPWeb URL and List GUIDs before importing into destination environment.

  11. Finish.


Comments

Popular posts from this blog

How to search Active Directory group members using Windows 10 built-in tools

How to check and reload PAC (Proxy Auto Configuration) file on Windows