可以使用以下步骤来实现:
创建一个Logic App,并添加一个“Recurrence”触发器来指定Logic App的执行间隔。
接下来,添加一个条件测试器,以便只有当指定条件为True时才会继续执行Logic App。
如果条件为True,则执行“Get attachments”操作,以获取要附加到电子邮件中的文件。
如果未找到任何文件,则结束Logic App。
如果找到文件,则执行“Send an email”操作,并将文件添加到附件字段中。
下面是示例代码:
{
"$connections": {
"value": {
"email_1": {
"connectionId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/connections/email-1",
"connectionName": "email-1",
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/managedApis/email"
}
}
},
"triggers": {
"Recurrence": {
"type": "Recurrence",
"recurrence": {
"frequency": "Hour",
"interval": 1
}
}
},
"conditions": {
"only_when_file_exists": {
"type": "If",
"inputs": {
"left": "@equals(length(body('Get_attachments')?['$content']),0)",
"right": false
}
}
},
"actions": {
"Get_attachments": {
"type": "Get_attachments",
"inputs": {
"body": {
"MailId": "Insert Mail Id here",
"MailFolder": "Insert Mail Folder here"
},
"host": {
"connection": {
"name": "@parameters('$connections')['email_1']['connectionId']"
}
}
}
},
"Send_email": {
"type": "Send_email",
"inputs": {
"body": {
"To": "Insert To email here",
"Subject": "