{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Condition": { "actions": { "Create_file": { "inputs": { "body": "file_name_that_is_copied", "host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } }, "method": "post", "path": "/datasets/@{encodeURIComponent(encodeURIComponent('{sharepoint URL}'))}/files", "queries": { "folderPath": "/Shared Documents/Issue Discussions", "name": "log_@{formatDateTime(utcNow(),'dd-MM-yyyy')}.txt", "queryParametersSingleEncoded": true } }, "runAfter": {}, "runtimeConfiguration": { "contentTransfer": { "transferMode": "Chunked" } }, "type": "ApiConnection" } }, "else": { "actions": { "Create_file_2": { "inputs": { "body": "@{body('Get_file_content_using_path')} \nnewfilename", "host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } }, "method": "post", "path": "/datasets/@{encodeURIComponent(encodeURIComponent('{sharepoint URL}'))}/files", "queries": { "folderPath": "/Shared Documents/Issue Discussions", "name": "log_@{formatDateTime(utcNow(),'dd-MM-yyyy')}.txt", "queryParametersSingleEncoded": true } }, "runAfter": {}, "runtimeConfiguration": { "contentTransfer": { "transferMode": "Chunked" } }, "type": "ApiConnection" } } }, "expression": { "and": [ { "equals": [ "@actions('Get_file_content_using_path').outputs.statusCode", 404 ] } ] }, "runAfter": { "Get_file_content_using_path": [ "Succeeded", "Failed" ] }, "type": "If" }, "Get_file_content_using_path": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } }, "method": "get", "path": "/datasets/@{encodeURIComponent(encodeURIComponent('{sharepoint URL}'))}/GetFileContentByPath", "queries": { "inferContentType": true, "path": "/Shared Documents/Issue Discussions/log_@{formatDateTime(utcNow(),'dd-MM-yyyy')}.txt", "queryParametersSingleEncoded": true } }, "runAfter": {}, "type": "ApiConnection" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" } }, "triggers": { "manual": { "inputs": {}, "kind": "Http", "type": "Request" } } }, "parameters": { "$connections": { "value": { "sharepointonline": { "connectionId": "/subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.Web/connections/sharepointonline", "connectionName": "sharepointonline", "id": "/subscriptions/{subscriptionID}/providers/Microsoft.Web/locations/northcentralus/managedApis/sharepointonline" } } } } }