Microsoft Flow – PowerApps – Create your own custom version of standard connectors

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.

Normally you would use the custom connector options within the Flow UI, avoiding manual json editing.

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

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.