Did you know that you can customize standard connectors in Microsoft Flow? Well you actually can’t modify them but you could create your own version as a custom connector.
Normally you would use the custom connector options within the Flow UI, avoiding manual json editing.
PowerShell for PowerApps and Flow
Table of Contents
You will need to start by downloading the PowerShell for PowerApps and Microsoft Flow. For instructions see the Microsoft site.
One of the commands available within this module is the Get-PowerAppConnector. Making it easy to get all the details for any of the connectors available in Flow and or PowerApps. If you wanted to get the SharePoint connector details you could run:
[code lang=text]
Get-PowerAppConnector -EnvironmentName “$Environment” -ConnectorName shared_sharepointonline
[/code]
Get the swagger
But there is more to this command. with the -ReturnConnectorSwagger switch you can get the swagger file as a PowerShell object.
[code lang=text]
$swagger = (Get-PowerAppConnector -EnvironmentName “$Environment” -ConnectorName shared_sharepointonline -ReturnConnectorSwagger).Swagger
[/code]
Convert to Json
Then the swagger file can be saved as a json file using the ConvertTo-JSon Cmdlet.
[code lang=text]
$swagger | ConvertTo-Json | out-file “e:\SharePoint.json”
[/code]
Fixing the json
There is still a small problem to resolve the paths of each action appear a bit messed up.
The below lines of PowerShell will generate the json that you would need in the method (get, post etc) sections for each path.
$members = $swagger.paths | Get-Member foreach ($member in $members) { if ($member.MemberType -ne "Method"){ $Name = $member.Name $swagger.paths."$Name" | ConvertTo-Json } }