Microsoft graph api 在“Exchange原因”中创建消息;“无法使PostBody多样化”;

Microsoft graph api 在“Exchange原因”中创建消息;“无法使PostBody多样化”;,microsoft-graph-api,microsoft-graph-mail,Microsoft Graph Api,Microsoft Graph Mail,几个月前,我有一些代码运行得很好,但是Graph API中的某些内容发生了变化,这不再有效。我正在尝试通过向以下url发送帖子,在现有文件夹中创建邮件: https://graph.microsoft.com/v1.0/users/jjones@transend.onmicrosoft.com/mailFolders/AAMkADNjAAA=/messages (文件夹id缩短) 调用失败,出现http错误400,返回的错误为“UnableToDeserializePostBody”。输入js

几个月前,我有一些代码运行得很好,但是Graph API中的某些内容发生了变化,这不再有效。我正在尝试通过向以下url发送帖子,在现有文件夹中创建邮件:

https://graph.microsoft.com/v1.0/users/jjones@transend.onmicrosoft.com/mailFolders/AAMkADNjAAA=/messages
(文件夹id缩短)

调用失败,出现http错误400,返回的错误为“UnableToDeserializePostBody”。输入json如下所示。通过实验,我能够将问题具体追溯到“singleValueExtendedProperties”。我通常会把几个属性放在那里,但是在这个测试中,除了你看到的那一个,我删除了所有属性。我也尝试过其他属性,它们都失败了。这看起来像是一些愚蠢的格式错误,但我看不出来。谢谢你的帮助

{
"subject": "Test again",
"Sender": {
"emailAddress": {
"name": "John Doe",
"address": "missing@domain.com"
}
},
"body": {
"contentType": "TEXT",
"content": "This is a text message."
},
"toRecipients": [
{
"emailAddress": {
"name": "Jane Smith",
"address": "missing@domain.com"
}
}
],
"ccRecipients": [
{
"emailAddress": {
"name": "Bob Jones",
"address": "missing@domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"propertyId": "SystemTime 0x0039",
"value": "1998-07-29T21:30:00.0000+00:00"
}
],
"importance": "normal"
}


这里的主要问题是您在中指定的属性('propertyid')无效。singleValueExtendedProperties中只有2个属性。一个是
id
,另一个是
value

将“propertyId”替换为
id

我已经在POSTMAN中测试了它,您的有效负载将propertyId更改为id,它成功了

请求机构:-

{
"subject": "Test again",
"Sender": {
"emailAddress": {
"name": "John Doe",
"address": "missing@domain.com"
}
},
"body": {
"contentType": "TEXT",
"content": "This is a text message."
},
"toRecipients": [
{
"emailAddress": {
"name": "Jane Smith",
"address": "missing@domain.com"
}
}
],
"ccRecipients": [
{
"emailAddress": {
"name": "Bob Jones",
"address": "missing@domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "SystemTime 0x0039",
"value": "1998-07-29T21:30:00.0000+00:00"
}
],
"importance": "normal"
}

嗨,杰夫,如果发布的答案解决了您的问题,请单击复选标记将其标记为答案。这样做有助于其他人找到问题的答案。看到了,谢谢,这看起来确实有效。我敢肯定,自从去年夏天我最初编写这段代码以来,Graph中一定发生了一些变化,但这很好。我正在努力用postman测试我的问题。在邮递员中测试之前不确定如何获取令牌