LogicApps / Graph API-从共享邮箱中删除电子邮件

时间:2020-08-13 09:54:17

标签: microsoft-graph-api azure-logic-apps

按标题。 虽然可以处理自己的邮箱,但我希望在LogicApps中理想地处理共享邮箱。我可以阅读电子邮件,但是我想通过删除邮件来进行清理。

Logic Apps似乎不提供该操作,除非弄错了图形api也不提供?

有人管理吗?

2 个答案:

答案 0 :(得分:0)

为此,我编写了一个逻辑应用程序示例供您参考:

在开始之前,请提供整个逻辑应用程序: enter image description here

1。。在第一个“ HTTP”操作中,我请求访问令牌。 enter image description here

2。。然后添加“ Parse JSON”操作以解析来自第一个“ HTTP”操作的响应以获取访问令牌。 enter image description here

架构应为:

{
    "properties": {
        "access_token": {
            "type": "string"
        },
        "expires_in": {
            "type": "integer"
        },
        "ext_expires_in": {
            "type": "integer"
        },
        "token_type": {
            "type": "string"
        }
    },
    "type": "object"
}

3。。在第二个“ HTTP”操作中,我通过上述步骤中的访问令牌请求所有消息。 enter image description here

4。之后,我们需要使用另一个“ Parse JSON”操作来解析来自“ HTTP 2”的响应。 enter image description here

架构应为:

{
    "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”中循环valueenter image description here

6。。在“对于每个”中,我们需要添加第三个“ HTTP”操作,如下图所示: enter image description here

7。。运行逻辑应用程序,它将删除共享邮箱中的所有邮件。

顺便说一句:

在运行逻辑应用程序之前,您需要在天蓝色的广告应用程序注册中搜索client_id,以找到该应用程序并为其添加Mail.ReadWrite权限。另外,请不要忘记授予管理员同意。 enter image description here

答案 1 :(得分:0)

update on 6th May 2020起,这已经成为可能。现在,许多操作都支持一个Original Mailbox Address可选参数,您可以将其设置为访问共享邮箱:

从2020年5月6日开始,通过可选的“邮箱地址”参数为某些操作添加了共享邮箱支持,从而允许您指定共享邮箱地址以供操作访问。

删除电子邮件(V2)操作支持以下参数:

Finding the Original Mailbox Address parameter

然后您填写共享邮箱的电子邮件地址: Supplying an original mailbox address

随后,这将成功找到您的消息ID,并为您删除电子邮件: enter image description here