[英]Microsoft graph api update event returns HTTP error 400 bad request
I am using MS Graph API in Pega 8.6.4 to update an event start and end date, attendees, and location if needed using PATCH but would always get an HTTP error 400 BAD REQUEST.我在 Pega 8.6.4 中使用 MS Graph API 来更新活动开始和结束日期、参与者和位置(如果需要)使用 PATCH,但总是会收到 HTTP 错误 400 BAD REQUEST。 Not sure what is going on since in my application I am able to create an event and cancel it.不确定发生了什么,因为在我的应用程序中我能够创建一个事件并取消它。
Request data:
{Request Message={"subject":"X",
"start":{"timeZone":"W. Europe Standard Time","DateTime2":"20220727T103000.000 GMT"},
"end":{"timeZone":"W. Europe Standard Time","DateTime2":"20220727T113000.000 GMT"},
"location":{"uniqueIdType":"private","displayName":"X","locationType":"default","uniqueId":"X"},
"body":{"contentType":"html",
"content":"<html> \t<body> \t\t<p>Afspraak met: X</p> \t\t<p>X \nANTWERPEN </p> \t\t<p>E-mailadres: X</p> \t\t<p>Telefoonummer: X</p> \t\t<p>Klantnummer: 45</p> </body> </html> "}}}
Method: PATCH
URL: https://graph.microsoft.com/v1.0/users/{userprincipalname}/events/{EventID}
Request header: {Content-Type = "application/json"}
Here the problem is with the properties of start
property.这里的问题在于start
属性的属性。 As you can see this documentation of event object , there is a property called start to specify the start time of an event.正如您可以看到事件 object 的此文档,有一个名为 start 的属性来指定事件的开始时间。 If you obseve, it is of type DateTimeTimeZone object.如果您观察到,它的类型是DateTimeTimeZone object。 If you check the properties for this object, you can see that we have dateTime
and timeZone
.如果您检查此 object 的属性,您可以看到我们有dateTime
和timeZone
。
Now just if you compare these properties with the data you are giving in JSON, you can see that in your JSON data the property is DateTime2
but according to documentation it has only those above two properties only, one of which is dateTime
, so simply modify your JSON data property to dateTime
and value to something like the format shared here with example.现在,如果您将这些属性与您在 JSON 中提供的数据进行比较,您可以看到在您的 JSON 数据中,该属性是DateTime2
但根据文档,它只有上述两个属性,其中一个是dateTime
,所以只需修改您的 JSON 数据属性为dateTime
和值,类似于此处与示例共享的格式。
Below screenshot is the sample JSON used from your data and it was successful.下面的屏幕截图是从您的数据中使用的示例 JSON,它是成功的。
Modified JSON:修改 JSON:
{
"subject": "X",
"start": {
"timeZone": "W. Europe Standard Time",
"dateTime": "2022-07-27T10:30:00.0000000"
},
"end": {
"timeZone": "W. Europe Standard Time",
"dateTime": "2022-07-27T11:30:00.0000000"
},
"location": {
"uniqueIdType": "private",
"displayName": "X",
"locationType": "default",
"uniqueId": "X"
},
"body": {
"contentType": "html",
"content": "<html> <body> <p>Afspraak met: X</p> <p>X ANTWERPEN </p> <p>E-mailadres: X</p> <p>Telefoonummer: X</p> <p>Klantnummer: 45</p> </body> </html> "
}
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.