【发布时间】:2020-08-13 09:54:17
【问题描述】:
根据标题。 虽然处理我自己的邮箱很好,但我希望理想地处理 LogicApps 中的共享邮箱。我可以阅读邮件,但我想通过删除邮件进行清理。
Logic Apps 似乎不提供该操作,除非弄错,否则图形 api 也不提供?
有人处理过这个吗?
【问题讨论】:
标签: microsoft-graph-api azure-logic-apps
根据标题。 虽然处理我自己的邮箱很好,但我希望理想地处理 LogicApps 中的共享邮箱。我可以阅读邮件,但我想通过删除邮件进行清理。
Logic Apps 似乎不提供该操作,除非弄错,否则图形 api 也不提供?
有人处理过这个吗?
【问题讨论】:
标签: microsoft-graph-api azure-logic-apps
自从update on 6th May 2020 以来,这已经成为可能。许多操作现在支持Original Mailbox Address 可选参数,您可以设置该参数以访问共享邮箱:
自 2020 年 5 月 6 日起,通过可选的“邮箱地址”参数为某些操作添加了共享邮箱支持,允许您为操作指定要访问的共享邮箱地址。
删除电子邮件 (V2) 操作支持此参数:
【讨论】:
针对这个需求,我写了一个逻辑应用示例供大家参考:
2. 然后我添加一个“解析 JSON”操作来解析来自第一个“HTTP”操作的响应以获取访问令牌。
架构应该是:
{
"properties": {
"access_token": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"ext_expires_in": {
"type": "integer"
},
"token_type": {
"type": "string"
}
},
"type": "object"
}
3. 在第二个“HTTP”操作中,我通过上述步骤中的访问令牌请求所有消息。
4. 之后,我们需要使用另一个“Parse JSON”动作来解析来自“HTTP 2”的响应。
架构应该是:
{
"properties": {
"@@odata.context": {
"type": "string"
},
"value": {
"items": {
"properties": {
"@@odata.etag": {
"type": "string"
},
"bccRecipients": {
"type": "array"
},
"body": {
"properties": {
"content": {
"type": "string"
},
"contentType": {
"type": "string"
}
},
"type": "object"
},
"bodyPreview": {
"type": "string"
},
"categories": {
"type": "array"
},
"ccRecipients": {
"type": "array"
},
"changeKey": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"conversationIndex": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"flag": {
"properties": {
"flagStatus": {
"type": "string"
}
},
"type": "object"
},
"from": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"hasAttachments": {
"type": "boolean"
},
"id": {
"type": "string"
},
"importance": {
"type": "string"
},
"inferenceClassification": {
"type": "string"
},
"internetMessageId": {
"type": "string"
},
"isDeliveryReceiptRequested": {
"type": "boolean"
},
"isDraft": {
"type": "boolean"
},
"isRead": {
"type": "boolean"
},
"isReadReceiptRequested": {
"type": "boolean"
},
"lastModifiedDateTime": {
"type": "string"
},
"parentFolderId": {
"type": "string"
},
"receivedDateTime": {
"type": "string"
},
"replyTo": {
"type": "array"
},
"sender": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"sentDateTime": {
"type": "string"
},
"subject": {
"type": "string"
},
"toRecipients": {
"items": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"emailAddress"
],
"type": "object"
},
"type": "array"
},
"webLink": {
"type": "string"
}
},
"required": [
"@@odata.etag",
"id",
"createdDateTime",
"lastModifiedDateTime",
"changeKey",
"categories",
"receivedDateTime",
"sentDateTime",
"hasAttachments",
"internetMessageId",
"subject",
"bodyPreview",
"importance",
"parentFolderId",
"conversationId",
"conversationIndex",
"isDeliveryReceiptRequested",
"isReadReceiptRequested",
"isRead",
"isDraft",
"webLink",
"inferenceClassification",
"body",
"sender",
"from",
"toRecipients",
"ccRecipients",
"bccRecipients",
"replyTo",
"flag"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
5. 然后使用“For each”并循环来自“Parse JSON 2”的value。
6. 在“For each”中,我们需要添加第三个“HTTP”操作,如下图所示:
7.运行逻辑应用,它将删除共享邮箱中的所有消息。
顺便说一句:
在运行逻辑应用之前,您需要在 azure 广告应用注册中搜索 client_id 以找到该应用并为其添加 Mail.ReadWrite 权限。也不要忘记授予管理员同意。
【讨论】: