Created
January 16, 2022 21:06
-
-
Save pankajsurti/f4298af6526c416d121b41a8f166ef17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"actions": { | |
"BodyForAzureFunction": { | |
"inputs": { | |
"Action": "@{triggerBody()?['GrantRevoke']?['Value']}", | |
"ClientAppID": "@{triggerBody()?['ApplicationID']?['Value']}", | |
"DisplayName": "@{triggerBody()?['ApplicationID_x003a_AppName']?['Value']}", | |
"Permission": "@{triggerBody()?['ReadWrite']?['Value']}", | |
"SiteURL": "@{triggerBody()?['Title']}" | |
}, | |
"runAfter": { | |
"Condition_to_Check_Read_or_Write_Selected": [ | |
"Succeeded" | |
] | |
}, | |
"type": "Compose" | |
}, | |
"Condition": { | |
"actions": { | |
"Delete_item": { | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['sharepointonline']['connectionId']" | |
} | |
}, | |
"method": "delete", | |
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://m365x162783.sharepoint.com/sites/SitesSelected'))}/tables/@{encodeURIComponent(encodeURIComponent('caf3e9ea-5319-469c-9305-9fc63c549dc6'))}/items/@{encodeURIComponent(triggerBody()?['ID'])}" | |
}, | |
"runAfter": {}, | |
"type": "ApiConnection" | |
} | |
}, | |
"expression": { | |
"and": [ | |
{ | |
"equals": [ | |
"@body('Update_item')?['GrantRevoke']?['Value']", | |
"Revoke" | |
] | |
} | |
] | |
}, | |
"runAfter": { | |
"Update_item": [ | |
"Succeeded" | |
] | |
}, | |
"type": "If" | |
}, | |
"Condition_to_Check_Grant_or_Revoke_Selected": { | |
"actions": { | |
"Set_ChangeInGrantRevokeFlag_variable": { | |
"inputs": { | |
"name": "ChangeInGrantRevokeFlag", | |
"value": "@true" | |
}, | |
"runAfter": {}, | |
"type": "SetVariable" | |
} | |
}, | |
"else": { | |
"actions": { | |
"Reset_ChangeInGrantRevokeFlag_variable": { | |
"inputs": { | |
"name": "ChangeInGrantRevokeFlag", | |
"value": "@false" | |
}, | |
"runAfter": {}, | |
"type": "SetVariable" | |
} | |
} | |
}, | |
"expression": { | |
"and": [ | |
{ | |
"equals": [ | |
"@not(equals(triggerBody()?['GrantRevoke']?['Value'], triggerBody()?['GrantRevokeCopy']))", | |
"@true" | |
] | |
} | |
] | |
}, | |
"runAfter": { | |
"Initialize_variable_ChangeInReadWriteFlag": [ | |
"Succeeded" | |
] | |
}, | |
"type": "If" | |
}, | |
"Condition_to_Check_Read_or_Write_Selected": { | |
"actions": { | |
"Set_ChangeInReadWriteFlag_variable": { | |
"inputs": { | |
"name": "ChangeInReadWriteFlag", | |
"value": "@true" | |
}, | |
"runAfter": {}, | |
"type": "SetVariable" | |
} | |
}, | |
"else": { | |
"actions": { | |
"Reset_ChangeInReadWriteFlag_variable": { | |
"inputs": { | |
"name": "ChangeInReadWriteFlag", | |
"value": "@false" | |
}, | |
"runAfter": {}, | |
"type": "SetVariable" | |
} | |
} | |
}, | |
"expression": { | |
"and": [ | |
{ | |
"equals": [ | |
"@not(equals(triggerBody()?['ReadWrite']?['Value'], triggerBody()?['ReadWriteCopy']))", | |
"@true" | |
] | |
} | |
] | |
}, | |
"runAfter": { | |
"Condition_to_Check_Grant_or_Revoke_Selected": [ | |
"Succeeded" | |
] | |
}, | |
"type": "If" | |
}, | |
"GrantRevokeHttpTrigger_2": { | |
"inputs": { | |
"body": "@outputs('BodyForAzureFunction')", | |
"function": { | |
"id": "/subscriptions/e54b393b-8772-4e4c-9088-4074b929bf94/resourceGroups/SiteSelected-RG/providers/Microsoft.Web/sites/SPOSitesSelected/functions/GrantRevokeHttpTrigger" | |
} | |
}, | |
"runAfter": { | |
"BodyForAzureFunction": [ | |
"Succeeded" | |
] | |
}, | |
"type": "Function" | |
}, | |
"Initialize_variable_ChangeInGrantRevokeFlag": { | |
"inputs": { | |
"variables": [ | |
{ | |
"name": "ChangeInGrantRevokeFlag", | |
"type": "boolean", | |
"value": "@false" | |
} | |
] | |
}, | |
"runAfter": {}, | |
"type": "InitializeVariable" | |
}, | |
"Initialize_variable_ChangeInReadWriteFlag": { | |
"inputs": { | |
"variables": [ | |
{ | |
"name": "ChangeInReadWriteFlag", | |
"type": "boolean", | |
"value": "@false" | |
} | |
] | |
}, | |
"runAfter": { | |
"Initialize_variable_ChangeInGrantRevokeFlag": [ | |
"Succeeded" | |
] | |
}, | |
"type": "InitializeVariable" | |
}, | |
"Update_item": { | |
"inputs": { | |
"body": { | |
"GrantRevoke": { | |
"Value": "@triggerBody()?['GrantRevoke']?['Value']" | |
}, | |
"GrantRevokeCopy": "@triggerBody()?['GrantRevoke']?['Value']", | |
"ReadWrite": { | |
"Value": "@triggerBody()?['ReadWrite']?['Value']" | |
}, | |
"ReadWriteCopy": "@triggerBody()?['ReadWrite']?['Value']", | |
"RecordEngineSteps": "@{body('GrantRevokeHttpTrigger_2')}", | |
"Title": "@triggerBody()?['Title']" | |
}, | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['sharepointonline']['connectionId']" | |
} | |
}, | |
"method": "patch", | |
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://m365x162783.sharepoint.com/sites/SitesSelected'))}/tables/@{encodeURIComponent(encodeURIComponent('caf3e9ea-5319-469c-9305-9fc63c549dc6'))}/items/@{encodeURIComponent(triggerBody()?['ID'])}" | |
}, | |
"runAfter": { | |
"GrantRevokeHttpTrigger_2": [ | |
"Succeeded" | |
] | |
}, | |
"type": "ApiConnection" | |
} | |
}, | |
"contentVersion": "1.0.0.0", | |
"outputs": {}, | |
"parameters": { | |
"$connections": { | |
"defaultValue": {}, | |
"type": "Object" | |
} | |
}, | |
"triggers": { | |
"When_an_item_is_created_or_modified": { | |
"conditions": [ | |
{ | |
"expression": "@or(not(equals(triggerBody()?['GrantRevoke']?['Value'], triggerBody()?['GrantRevokeCopy'])),not(equals(triggerBody()?['ReadWrite']?['Value'], triggerBody()?['ReadWriteCopy'])))" | |
} | |
], | |
"evaluatedRecurrence": { | |
"frequency": "Minute", | |
"interval": 1 | |
}, | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['sharepointonline']['connectionId']" | |
} | |
}, | |
"method": "get", | |
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://m365x162783.sharepoint.com/sites/SitesSelected'))}/tables/@{encodeURIComponent(encodeURIComponent('caf3e9ea-5319-469c-9305-9fc63c549dc6'))}/onupdateditems" | |
}, | |
"recurrence": { | |
"frequency": "Minute", | |
"interval": 1 | |
}, | |
"splitOn": "@triggerBody()?['value']", | |
"type": "ApiConnection" | |
} | |
} | |
}, | |
"parameters": { | |
"$connections": { | |
"value": { | |
"sharepointonline": { | |
"connectionId": "/subscriptions/e54b393b-8772-4e4c-9088-4074b929bf94/resourceGroups/SiteSelected-RG/providers/Microsoft.Web/connections/sharepointonline", | |
"connectionName": "sharepointonline", | |
"id": "/subscriptions/e54b393b-8772-4e4c-9088-4074b929bf94/providers/Microsoft.Web/locations/centralus/managedApis/sharepointonline" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment