问题描述
我正在尝试使用图形/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.
我指的是以下Microsoft文档:
I am referring below Microsoft document:
https://docs.microsoft.com/zh-CN/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
推荐答案
文档说:
这表示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": ["[email protected]", "[email protected]"],
"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点免费
- 下午12点-下午1点忙
- 下午1点-下午2点忙
- 下午2点-下午3点免费
- 下午3点-下午4点免费
- 下午4点-下午5点暂定
- 下午5点-下午6点免费
如果您在将availabilityViewInterval
设置为30的情况下执行了相同的请求,则会返回availabilityView
值220000222200001100
,每个数字代表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.
这篇关于了解Microsoft graph/getSchedule Api功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!