Microsoft Graph API - 批准审核请求
Microsoft Graph API - Approve Moderation Request
我希望能够通过 Graph API 批准审核请求。我已经提到 Approve Moderation Request. I was not able to get it to work. Although, there is a PowerShell script available at EWS Managed API and Powershell How-To Series Part 11 Moderation 我设法开始工作了。
Graph API 不支持此功能,因此需要进行一些修改。我想要一些有关如何执行此操作的指导。
这是我发送到终点的JSONhttps://graph.microsoft.com/v1.0/me/sendMail
{
"message": {
"subject": "Approve:MessageName"
},
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "systemmailbox@domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
这是我收到的回复
{
"error": {
"code": "ErrorInvalidRecipients",
"message": "At least one recipient isn't valid., A message can't be sent because it contains no recipients.",
"innerError": {
"date": "2020-08-19T23:40:07",
"request-id": "7g5h732v-6uhb-3212-b6f1-43f6eeb139wq"
}
}
}
如有任何帮助,我们将不胜感激。
您的 Json 请求中存在语法问题,例如,在主题结束后仔细查看消息 } 这意味着您的帖子唯一应该是消息的主题
{
"message": {
"subject": "Approve:MessageName",
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "address.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
}
额外
为了使这项工作正常进行,您需要从应用程序漫游者邮箱获取批准请求,以便像这样查询
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String 0x001a' and ep/value eq 'IPM.Note.Microsoft.Approval.Request')&$expand=singleValueExtendedProperties($filter%3D(Id eq 'Binary 0x0031') or (Id eq 'String 0x0E1D'))
这将为您提供需要在发送中使用的报告标记 0x0031 值,您还需要包括 Approve Verb Extended 属性
{
id = "String {00062008-0000-0000-C000-000000000046} Id 0x8524"
value = "Approve"
}
我从我的博客中转换了脚本,我将在本周发布,它只批准邮箱中的最后一封电子邮件,您可以查看它 https://github.com/gscales/Powershell-Scripts/blob/master/Graph101/Moderation.ps1(查看 Invoke-ApproveModerationRequest)
我希望能够通过 Graph API 批准审核请求。我已经提到 Approve Moderation Request. I was not able to get it to work. Although, there is a PowerShell script available at EWS Managed API and Powershell How-To Series Part 11 Moderation 我设法开始工作了。
Graph API 不支持此功能,因此需要进行一些修改。我想要一些有关如何执行此操作的指导。
这是我发送到终点的JSONhttps://graph.microsoft.com/v1.0/me/sendMail
{
"message": {
"subject": "Approve:MessageName"
},
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "systemmailbox@domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
这是我收到的回复
{
"error": {
"code": "ErrorInvalidRecipients",
"message": "At least one recipient isn't valid., A message can't be sent because it contains no recipients.",
"innerError": {
"date": "2020-08-19T23:40:07",
"request-id": "7g5h732v-6uhb-3212-b6f1-43f6eeb139wq"
}
}
}
如有任何帮助,我们将不胜感激。
您的 Json 请求中存在语法问题,例如,在主题结束后仔细查看消息 } 这意味着您的帖子唯一应该是消息的主题
{
"message": {
"subject": "Approve:MessageName",
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "address.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
}
额外
为了使这项工作正常进行,您需要从应用程序漫游者邮箱获取批准请求,以便像这样查询
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String 0x001a' and ep/value eq 'IPM.Note.Microsoft.Approval.Request')&$expand=singleValueExtendedProperties($filter%3D(Id eq 'Binary 0x0031') or (Id eq 'String 0x0E1D'))
这将为您提供需要在发送中使用的报告标记 0x0031 值,您还需要包括 Approve Verb Extended 属性
{
id = "String {00062008-0000-0000-C000-000000000046} Id 0x8524"
value = "Approve"
}
我从我的博客中转换了脚本,我将在本周发布,它只批准邮箱中的最后一封电子邮件,您可以查看它 https://github.com/gscales/Powershell-Scripts/blob/master/Graph101/Moderation.ps1(查看 Invoke-ApproveModerationRequest)