Awesome
SharePointWorkflowConverter
A proof-of-concept C# console application for retrieving legacy 2010 & 2013 custom SharePoint workflow definition files, and creating new Power Automate flows programmatically.
General Notes:
- This project is a proof-of-concept to demonstrate that it's possible to programmatically retrieve/parse SharePoint legacy workflow definition files and create new Power Automate flows. As for specific use cases and implementation, this is a launch pad for you to build those out.
- Only compatible with SharePoint Online.
- Tested with a tenant global admin account.
- Uses the 4.7.2 .NET Framework.
- The code for retrieving legacy workflows and the code for creating a new Power Automate flow are contained in 2 separate respective functions:
GetLegacyWorkflow()
andCreateNewWorkflow()
. If you don't need one or the other for your purposes, simply comment them out.
Notes about retrieving legacy 2010/2013 workflows:
- Legacy authentication must be enabled in the tenant for this code to work.
- All custom list/library workflows created within SharePoint Designer will have
*.xoml
and*.xoml.wfconfig.xml
files. Each file contains pertinent information describing the workflow, such as list/library associations, actions, etc. You can manually view these files in SharePoint Designer 2013 by clicking All Files from the left-hand navigation and selecting > Workflows. The files can be programmatically retrieved using this project and parsed to map to equivalent Power Automate connections, actions, etc. - Declarative
*.xoml
and*.xoml.wfconfig.xml
files do not appear to exist for workflows created from OOB SharePoint 2010 or 2013 workflow templates. (If you can find them - I'll buy you a beverage of your choice!)
Notes about creating Power Automate flows:
- This project leverages the Power Automate Management Web API to create a new Power Automate flow.
- Per Microsoft's documentation, flows shown in the My Flows tab are not supported by these APIs. Instead you will find flows created via the API in your Solutions > Default Solution tab.
(I have opened a GitHub issue inquiring about how to programmatically create Power Automate flows within solutions other than Default.) - The meat and potatoes of the flow payload is in the
clientdata
property. To help determine appropriate content for this section, I recommend manually creating the desired Power Automate flow using the UI. Then, you can leverage the API to get theclientdata
content for your manual flow and copy/paste it into the payload for your new flow.
(Also a great strategy for programmatically bulk-creating Power Automate flows in an environment!) - Once you successfully create a new Power Automate flow via the API, you will need to turn it on. Then, do a Ctrl+F5 refresh to confirm your connections appear as expected.