Did you know that you can customise out of the box connectors in Microsoft Flow? Well you actually can’t modify them but you could create your own version as a custom connector.

PowerShell for PowerApps and Flow

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:

Get-PowerAppConnector -EnvironmentName "$Environment" -ConnectorName shared_sharepointonline

Get the swagger

But there is more to this command. with the -ReturnConnectorSwagger switch you can get the swagger file as a PowerShell object.

$swagger = (Get-PowerAppConnector -EnvironmentName "$Environment" -ConnectorName shared_sharepointonline -ReturnConnectorSwagger).Swagger

Convert to Json

Then the swagger file can be saved as a json file using the ConvertTo-JSon Cmdlet.

$swagger | ConvertTo-Json | out-file "e:\SharePoint.json"

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
}
}

 

 

 

Advertisements