LogicApp Outlook365 to Google Calendar
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
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"workflows_OutlookSync_name": { | |
"defaultValue": "OutlookSync", | |
"type": "String" | |
}, | |
"connections_googlecalendar_externalid": { | |
"defaultValue": "/subscriptions/yoursub/resourceGroups/yourrg/providers/Microsoft.Web/connections/googlecalendar", | |
"type": "String" | |
}, | |
"connections_office365_externalid": { | |
"defaultValue": "/subscriptions/yoursub/resourceGroups/yourrg/providers/Microsoft.Web/connections/office365", | |
"type": "String" | |
} | |
}, | |
"variables": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Logic/workflows", | |
"apiVersion": "2017-07-01", | |
"name": "[parameters('workflows_OutlookSync_name')]", | |
"location": "westeurope", | |
"properties": { | |
"state": "Enabled", | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"$connections": { | |
"defaultValue": {}, | |
"type": "Object" | |
} | |
}, | |
"triggers": { | |
"When_an_event_is_added,_updated_or_deleted_(V2)": { | |
"recurrence": { | |
"frequency": "Minute", | |
"interval": 15 | |
}, | |
"splitOn": "@triggerBody()?['value']", | |
"type": "ApiConnection", | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['office365']['connectionId']" | |
} | |
}, | |
"method": "get", | |
"path": "/datasets/calendars/v2/tables/sample/onchangeditems", | |
"queries": { | |
"incomingDays": 300, | |
"pastDays": 2 | |
} | |
} | |
} | |
}, | |
"actions": { | |
"For_each": { | |
"foreach": "@body('List_the_events_on_a_calendar')?['items']", | |
"actions": { | |
"Delete_an_event": { | |
"runAfter": {}, | |
"type": "ApiConnection", | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['googlecalendar']['connectionId']" | |
} | |
}, | |
"method": "delete", | |
"path": "/calendars/@{encodeURIComponent('somecalendar@group.calendar.google.com')}/events/@{encodeURIComponent(items('For_each')?['id'])}" | |
} | |
} | |
}, | |
"runAfter": { | |
"List_the_events_on_a_calendar": [ | |
"Succeeded" | |
] | |
}, | |
"type": "Foreach" | |
}, | |
"List_the_events_on_a_calendar": { | |
"runAfter": {}, | |
"type": "ApiConnection", | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['googlecalendar']['connectionId']" | |
} | |
}, | |
"method": "get", | |
"path": "/calendars/@{encodeURIComponent('somecalendar@group.calendar.google.com')}/events", | |
"queries": { | |
"q": "@triggerBody()?['id']" | |
} | |
} | |
}, | |
"Switch": { | |
"runAfter": { | |
"For_each": [ | |
"Succeeded" | |
] | |
}, | |
"cases": { | |
"Case_updated": { | |
"case": "deleted", | |
"actions": {} | |
} | |
}, | |
"default": { | |
"actions": { | |
"Create_an_event_Google": { | |
"runAfter": {}, | |
"type": "ApiConnection", | |
"inputs": { | |
"body": { | |
"description": "@triggerBody()?['id']", | |
"end": "@{triggerBody()?['end']}Z", | |
"location": "@triggerBody()?['location']", | |
"start": "@{triggerBody()?['start']}Z", | |
"summary": "@triggerBody()?['subject']" | |
}, | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['googlecalendar']['connectionId']" | |
} | |
}, | |
"method": "post", | |
"path": "/calendars/@{encodeURIComponent('somecalendar@group.calendar.google.com')}/events" | |
} | |
} | |
} | |
}, | |
"expression": "@triggerBody()?['ActionType']", | |
"type": "Switch" | |
} | |
}, | |
"outputs": {} | |
}, | |
"parameters": { | |
"$connections": { | |
"value": { | |
"googlecalendar": { | |
"connectionId": "[parameters('connections_googlecalendar_externalid')]", | |
"connectionName": "googlecalendar", | |
"id": "/subscriptions/yoursub/providers/Microsoft.Web/locations/westeurope/managedApis/googlecalendar" | |
}, | |
"office365": { | |
"connectionId": "[parameters('connections_office365_externalid')]", | |
"connectionName": "office365", | |
"id": "/subscriptions/yoursub/providers/Microsoft.Web/locations/westeurope/managedApis/office365" | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment