了解 Microsoft graph/getSchedule Api 功能
我正在尝试使用 graph/getSchedule api 来检查会议冲突.但是,我不太了解请求输入字段availabilityViewInterval"的功能和用法.
I am trying to use graph /getSchedule api to check for meeting conflict. However I'm not quite about functionality and usage of request input field "availabilityViewInterval".
我的基本要求是传递开始和结束日期时间并查看资源是否可用(空闲/忙碌).虽然我可以在/getSchedule Api 中得到它,但不确定请求和响应中的某些字段.
My basic requirement is to pass a start and end dateTime and see if the resource is available(free/busy). Although I am able to get that in /getSchedule Api but not sure on some of the fields in request and response.
availabilityViewInterval":这是一个请求字段,在文档中声明为可选,但在使用图形客户端时,我需要为此传递值.它接受从 5 到 1440 的 int 值,但不确定它的作用以及我应该传递的值是多少?
availabilityView":这是一个响应字段,返回一个字符串值.但我无法理解.这个值是什么以及它是如何计算的?它有什么意义以及如何利用它?
"availabilityView": This is a response field and returns a string value. But i am unable to understand it. What is this value for and how is it calculated? what is its significance and how it can be utilized?
请求:
ICalendarGetScheduleCollectionPage response = graphClient.users("usrEmailAddress").calendars(calendar.id)
.getSchedule(schedulesList,endTime,startTime,availabilityViewInterval)
.buildRequest()
.post();
以下是我的示例响应(请求中的availabilityViewInterval 值均为5,但响应availabilityView 不同):
Below is my sample response(both time the availabilityViewInterval value is 5 in request but response availabilityView is different):
**"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"
}
响应 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"
}
响应 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"
}
注意:所有请求的开始和结束时间都不同,但在所有情况下,availabilityViewInterval 字段都是 5.
Note: The start and end time for all the request were different but availabilityViewInterval field was 5 in all the cases.
我指的是下面的微软文档:
I am referring below Microsoft document:
https://docs.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=java
请帮助我了解请求中availabilityViewInterval"和响应中availabilityView"的意义和用法.此外,状态值是否只是空闲/忙碌"或它也可以具有任何其他值?提前致谢
Please help me understand significance and usage of "availabilityViewInterval" in request and "availabilityView" in response. Also, will status value be only "free/busy" or it can have any other value too? Thanks in advance
推荐答案
文档说:
表示响应中可用性视图中的时隙持续时间.默认为 30 分钟,最小值为 5,最大值为 1440.可选.
Represents the duration of a time slot in an availabilityView in the response. The default is 30 minutes, minimum is 5, maximum is 1440. Optional.
这表示availabilityView
中的时隙大小.看一个例子可能会有所帮助.
What this signifies are the size of a time slot in the availabilityView
. It's probably helpful to look at an example.
这是来自文档的示例请求:
Here's the sample request from the doc:
{
"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
}
availabilityViewInterval
设置为 60,这意味着返回的 availabilityView
中的每个数字代表 60 分钟的时间块.示例响应显示了 Megan 的值 200220010
.0 = 空闲,1 = 暂定,2 = 忙碌,我们可以将其解码为:
With availabilityViewInterval
set to 60, that means each numeral in the returned availabilityView
represents a 60 minute chunk of time. The sample response shows the value 200220010
for Megan. With 0 = free, 1 = tentative, and 2 = busy, we can decode this as:
- 上午 9 点 - 上午 10 点忙
- 上午 10 点 - 上午 11 点免费
- 上午 11 点至下午 12 点免费
- 12PM - 1PM 忙
- 下午 1 点 - 下午 2 点忙
- 下午 2 点 - 下午 3 点免费
- 下午 3 点 - 下午 4 点免费
- 下午 4 点 - 下午 5 点(暂定)
- 下午 5 点 - 下午 6 点免费
如果您在 availabilityViewInterval
设置为 30 的情况下执行相同的请求,您将返回 220000222200001100
的 availabilityView
值,每个数字代表一段 30 分钟的时间.
If you did this same request with availabilityViewInterval
set to 30, you'd get back an availabilityView
value of 220000222200001100
, each digit representing a 30 minute chunk of time.
相关文章