This is a copy of the procedure described 4 years ago within the comments of this idea https://ideas.powerapps.com/d365community/idea/6a081f72-16d3-4b5b-91bc-7698ca5e4159 which explains how to copy a SharePoint list form customized with Power Apps from a source site collection to a destination site collection.
IMPORTANT - This procedure is provided as is and I cannot be held responsible for any damage subsequent to following these steps (which, by the way I haven't tested for a couple of years now).
<<
Hi all,
Since many of you seem to encounter different problems when it comes to transporting or duplicating a SharePoint form from one place to another, I'll take some time here to describe the procedure in details (which, by the way, works fine for me for customized SharePoint forms AND for canvas PowerApps applications). I'll discuss also the use of PowerApps environments.
The most common case (I suppose) is when you wish to copy a SharePoint form customized with PowerApps from one site collection (i.e. DEVELOPPEMENT) to another (i.e. VALIDATION). Globally speaking, there are 4 steps to do so:
- Extract your SharePoint form from PowerApps into a ZIP file
- Convert your ZIP file to replace all DEV urls and GUIDs with VAL urls and GUIDs
- Import your converted ZIP file into PowerApps
- Publish the imported form
I. Extracting the SharePoint form
In this step you will extract the SharePoint customized form from your source (i.e. DEV site collection) using PowerApps native EXPORT feature to produce a ZIP file. Here is what you have to do:
- Go to the SharePoint list where you have your customized form that you wish to copy/transport
- From the gear menu, choose the List settings option
- In section General settings click on the Form settings link
- There you should have the second radio button checked (Use a custom form created in PowerApps...)
- Right under this radio button you will see some links. Click on the link called See versions and usage
- You will then be redirected to PowerApps on your form's details page
- There, click on the Export package (preview) button. You are redirected to the export package page.
- Give a name to your package (I prefer to use only alphanumeric characters here, no spaces, dashes and underscores... just in case). Let's say I call it MyForm.
- Don't touch anything else (even the IMPORT SETUP parameter which, in any case, will be prompted again during the import phase)
- Just click the Export button
- Your package is generated and the system shows up a file dialog box so you can save your ZIP file (by default, the system names it: <name in step 8>_AAAAMMDDHHmmss.zip); so in my example, its name is MyForm_20190514201458.zip). Feel free to give it another name of course.
II. Converting the package
Now comes the interesting part: replacing all source site collections urls and GUIDs in the package with all destination urls and GUIDs.
To do so, I use the following tool found on Github: FlowPowerAppsMigrator (many thanks to Zerg00s for this wonderfull tool). For your information, I have fixed one or two bugs in this tool. The fixed version can be found here (I'll try to find some time one day to update it directly on Github).
One last thing: as it is explained on the Github tool's page, it uses the PnP-PowerShell framework. All links and instructions can be found on the tool's page. The instructions below suppose your have already installed the PnP-PowerShell framework and unpacked the FlowPowerAppsMigrator tool.
So let's go convert our ZIP file:
- Let's say the FlowPowerAppsMigrator tool is located in the Downloads\FlowPowerAppsMigrator folder on your PC
- Go to that folder and copy your package ZIP file (in my case MyForm_20190514201458.zip) into the src subfolder
- Open a Windows PowerShell window (I personally perfer PowerShell ISE for its intellisense feature)
- Go to the Downloads\FlowPowerAppsMigrator folder
- Run the script .\RunAllScripts.ps1
- The script will first prompt you for the source SharePoint site url: for example https://mytenant.sharepoint.com/sites/DEV
- After a while the script will produce a CSV mapping file
- Then the script will prompt you again, now for the destination SharePoint site url: for example https://mytenant.sharepoint.com/sites/VAL
- After a while, the script will start the conversion procedure. But just before it actually converts your package, it will show you the old name of your form app and prompt you for a new name. I always choose here another name for my form app, like: MyForm-VAL.
- Then the conversion will take place: the script will open all JSON files that it will find inside your package (even the ones located into the MSAPP file) and replace for you all source urls and GUIDs with the destination ones. Coooool ! No need to do it manually anymore (such a pain !).
- Once the script ends go to the dist subfolder of the migration tool. There you will find your converted package named Converted_<name of your original file>.zip.
III. Importing the converted package
Now we are ready to import the new package in PowerApps. At this point, if you have different environments in PowerApps, choose the environment you want to import it in.
Note: prior to importing your converted package, all customized forms on the target list must be removed. To do so:
- Go to your target list settings page
- Click the Form settings link
- Check the Use the default SharePoint form radio button
- Save your changes by clicking the OK button
- Go back to the Form settings page and click the Delete custom form link and confirm the dialog box
Now you are ready to proceed with the import procedure:
- Go to PowerApps
- Choose your target environment if needed (but you can also import you converted package into the same environment as the one you did the extraction operation)
- In the left menu, go to Applications
- Click the Import package (preview) button
- Click the Download button and select your converted package ZIP file located in the dist folder of the migration tool
- Let PowerApps load your package
- Once loaded you will be redirected to a page when you will see the details of your package
- In the Review Package Content section, click on the red exclamation mark icon in front of your source app name (you could also click on the Update link or the Action wrench icon)
- There, in the Setup dropdown, choose the Create as new option (the Update
>>
Then end 😉