Skip to content

TracyGH/SharePointWorkflowConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  1. 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.
  2. Only compatible with SharePoint Online.
  3. Tested with a tenant global admin account.
  4. Uses the 4.7.2 .NET Framework.
  5. The code for retrieving legacy workflows and the code for creating a new Power Automate flow are contained in 2 separate respective functions: GetLegacyWorkflow() and CreateNewWorkflow(). If you don't need one or the other for your purposes, simply comment them out.

Notes about retrieving legacy 2010/2013 workflows:

  1. Legacy authentication must be enabled in the tenant for this code to work.
  2. 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. SharePoint Designer Screenshot
  3. 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:

  1. This project leverages the Power Automate Management Web API to create a new Power Automate flow.
  2. 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.)
  3. 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 the clientdata 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!)
  4. 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.
    Power Automate Screenshot

Happy Automating! :-)

About

A proof-of-concept C# console application for retrieving legacy 2010 & 2013 custom SharePoint workflow definition files, and creating new Power Automate flows programmatically.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages