Microsoft Graph-如何在Java中构造findMeetingTimes请求?

Microsoft Graph-如何在Java中构造findMeetingTimes请求?,java,outlook,microsoft-graph-api,outlook-restapi,Java,Outlook,Microsoft Graph Api,Outlook Restapi,我正在尝试在我的应用程序中实现findMeetingTimes请求。问题是,Microsoft文档中的确切代码不起作用()。在这里,我们将meetingDuration作为字符串传递,但所需的类型是javax.xml.datatype.Duration,这令人困惑,因为它是抽象类,显然与Microsoft提供的文档不匹配。正确的实现应该是什么样子 IGraphServiceClient graphClient = GraphServiceClient.builder().authentica

我正在尝试在我的应用程序中实现findMeetingTimes请求。问题是,Microsoft文档中的确切代码不起作用()。在这里,我们将meetingDuration作为字符串传递,但所需的类型是javax.xml.datatype.Duration,这令人困惑,因为它是抽象类,显然与Microsoft提供的文档不匹配。正确的实现应该是什么样子

  IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new HeaderOption("Prefer", "outlook.timezone=\"Pacific Standard Time\""));

LinkedList<AttendeeBase> attendeesList = new LinkedList<AttendeeBase>();
AttendeeBase attendees = new AttendeeBase();
attendees.type = AttendeeType.REQUIRED;
EmailAddress emailAddress = new EmailAddress();
emailAddress.name = "Alex Wilbur";
emailAddress.address = "alexw@contoso.onmicrosoft.com";
attendees.emailAddress = emailAddress;

attendeesList.add(attendees);

LocationConstraint locationConstraint = new LocationConstraint();
locationConstraint.isRequired = "false";
locationConstraint.suggestLocation = "false";
LinkedList<LocationConstraintItem> locationsList = new LinkedList<LocationConstraintItem>();
LocationConstraintItem locations = new LocationConstraintItem();
locations.resolveAvailability = "false";
locations.displayName = "Conf room Hood";
locationsList.add(locations);
locationConstraint.locations = locationsList;

TimeConstraint timeConstraint = new TimeConstraint();
timeConstraint.activityDomain = ActivityDomain.WORK;
LinkedList<TimeSlot> timeSlotsList = new LinkedList<TimeSlot>();
TimeSlot timeSlots = new TimeSlot();
DateTimeTimeZone start = new DateTimeTimeZone();
start.dateTime = "2019-04-16T09:00:00";
start.timeZone = "Pacific Standard Time";
timeSlots.start = start;
DateTimeTimeZone end = new DateTimeTimeZone();
end.dateTime = "2019-04-18T17:00:00";
end.timeZone = "Pacific Standard Time";
timeSlots.end = end;
timeSlotsList.add(timeSlots);
timeConstraint.timeSlots = timeSlotsList;

boolean isOrganizerOptional = false;

String meetingDuration = "PT1H";

boolean returnSuggestionReasons = true;

String minimumAttendeePercentage = "100";

graphClient.me()
    .findMeetingTimes(attendeesList,locationConstraint,timeConstraint,meetingDuration,null,isOrganizerOptional,returnSuggestionReasons,minimumAttendeePercentage)
    .buildRequest( requestOptions )
    .post();
IGraphServiceClient-graphClient=GraphServiceClient.builder().authenticationProvider(authProvider.buildClient();
LinkedList requestOptions=新建LinkedList();
添加(新标题选项(“首选”、“outlook.timezone=”太平洋标准时间“);
LinkedList AttendesList=新建LinkedList();
Attendebase Attendes=新Attendebase();
Attendes.type=AttendeType.REQUIRED;
EmailAddress EmailAddress=新的EmailAddress();
emailAddress.name=“Alex Wilbur”;
emailAddress.address=”alexw@contoso.onmicrosoft.com";
Attendes.emailAddress=电子邮件地址;
AttendesList.add(与会者);
LocationConstraint LocationConstraint=新的LocationConstraint();
locationConstraint.isRequired=“false”;
locationConstraint.suggestLocation=“false”;
LinkedList locationsList=新建LinkedList();
LocationConstraintItem位置=新的LocationConstraintItem();
locations.resolveavability=“false”;
locations.displayName=“Conf room Hood”;
位置列表添加(位置);
locationConstraint.locations=位置列表;
TimeConstraint TimeConstraint=新的TimeConstraint();
timeConstraint.activityDomain=activityDomain.WORK;
LinkedList timeSlotsList=新建LinkedList();
时隙时隙=新时隙();
DateTimeZone start=新的DateTimeZone();
start.dateTime=“2019-04-16T09:00:00”;
start.timeZone=“太平洋标准时间”;
timeSlots.start=开始;
DateTimeZone end=新的DateTimeZone();
end.dateTime=“2019-04-18T17:00:00”;
end.timeZone=“太平洋标准时间”;
timeSlots.end=结束;
timeSlotsList.add(时隙);
timeConstraint.timeslot=timeSlotsList;
布尔同构=假;
字符串会议持续时间=“PT1H”;
布尔returnSuggestionReasions=true;
字符串minimumattendepercentage=“100”;
graphClient.me()
.findMeetingTimes(与会者列表、地点限制、时间限制、会议持续时间、空值、同构、返回建议原因、最小与会者百分比)
.buildRequest(请求选项)
.post();
我成功地用正确的对象替换了会议持续时间:

 DatatypeFactory factory = DatatypeFactory.newInstance();
        javax.xml.datatype.Duration meetingDuration = factory.newDuration("PT1H");
        
        graphClient.me()
                .findMeetingTimes(attendeesList, null, timeConstraint, meetingDuration, null, true, true, 100.0)
                .buildRequest(requestOptions)
                .post();
问题是,现在如何捕获服务器响应?同样,MS文档中没有一个单词:/