Cro*_*roy 4 java microsoft-graph-sdks microsoft-graph-calendar microsoft-graph-teams microsoft-graph-api
我正在尝试使用 graph /getSchedule api 来检查会议冲突。但是,我不太了解请求输入字段“availabilityViewInterval”的功能和用法。
我的基本要求是传递开始和结束日期时间并查看资源是否可用(空闲/忙碌)。虽然我可以在 /getSchedule Api 中获取该信息,但不确定请求和响应中的某些字段。
“availabilityViewInterval”:这是一个请求字段,在文档中声明为可选,但在使用图形客户端时,我需要为此传递值。它接受 5 到 1440 之间的 int 值,但不确定它的作用以及我应该传递的值是什么?
“availabilityView”:这是一个响应字段,返回一个字符串值。但我无法理解它。这个值有什么用以及它是如何计算的?它的意义是什么以及如何利用它?
要求:
ICalendarGetScheduleCollectionPage response = graphClient.users("usrEmailAddress").calendars(calendar.id)
.getSchedule(schedulesList,endTime,startTime,availabilityViewInterval)
.buildRequest()
.post();
Run Code Online (Sandbox Code Playgroud)
下面是我的示例响应(两次请求中的availabilityViewInterval值都是5,但响应availabilityView是不同的):
**"availabilityView": "22"**,
"scheduleItems": [
{
"isPrivate": false,
"status": "busy",
"subject": "Test Meeting again",
"location": "",
"start": {
"dateTime": "2020-06-12T10:58:45.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-06-12T11:08:45.0000000",
"timeZone": "UTC"
}
}
],
"workingHours": {
"daysOfWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"startTime": "08:00:00.0000000",
"endTime": "17:00:00.0000000",
"timeZone": {
"name": "India Standard Time"
}
Run Code Online (Sandbox Code Playgroud)
回应2:
**"availabilityView": "00"**,
"scheduleItems": [],
"workingHours": {
"daysOfWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"startTime": "08:00:00.0000000",
"endTime": "17:00:00.0000000",
"timeZone": {
"name": "India Standard Time"
}
Run Code Online (Sandbox Code Playgroud)
回应3:
**"availabilityView": "220000000000"**,
"scheduleItems": [
{
"isPrivate": false,
"status": "busy",
"subject": "Test Meeting again",
"location": "",
"start": {
"dateTime": "2020-06-12T10:58:45.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-06-12T11:08:45.0000000",
"timeZone": "UTC"
}
}
],
"workingHours": {
"daysOfWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"startTime": "08:00:00.0000000",
"endTime": "17:00:00.0000000",
"timeZone": {
"name": "India Standard Time"
}
Run Code Online (Sandbox Code Playgroud)
注意:所有请求的开始和结束时间都不同,但在所有情况下,availabilityViewInterval 字段均为 5。
我指的是下面的微软文档:
https://learn.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=java
请帮助我理解请求中的“availabilityViewInterval”和响应中的“availabilityView”的意义和用法。另外,状态值只能是“忙/闲”还是也可以有任何其他值?提前致谢
文档说:
表示响应中可用性视图中的时间段的持续时间。默认值为 30 分钟,最小值为 5 分钟,最大值为 1440。可选。
这表示的是 中时隙的大小availabilityView。看一个例子可能会有所帮助。
这是来自文档的示例请求:
{
"schedules": ["adelev@contoso.onmicrosoft.com", "meganb@contoso.onmicrosoft.com"],
"startTime": {
"dateTime": "2019-03-15T09:00:00",
"timeZone": "Pacific Standard Time"
},
"endTime": {
"dateTime": "2019-03-15T18:00:00",
"timeZone": "Pacific Standard Time"
},
"availabilityViewInterval": 60
}
Run Code Online (Sandbox Code Playgroud)
设置availabilityViewInterval为 60 时,这意味着返回的每个数字availabilityView代表 60 分钟的时间块。200220010示例响应显示Megan 的值。0 = 空闲,1 = 暂定,2 = 忙碌,我们可以将其解码为:
如果您执行相同的请求并availabilityViewInterval设置为 30,您将返回一个availabilityView值220000222200001100,每个数字代表 30 分钟的时间块。
| 归档时间: |
|
| 查看次数: |
2855 次 |
| 最近记录: |