Java 在谷歌日历API中相遇
如何在java中的google日历api中添加google meet? 请帮帮我。我还没有理解谷歌的文档。 . 这里给出了源代码。在这里,我想使用用户gmail帐户创建事件。我没有任何G-suite帐户Java 在谷歌日历API中相遇,java,google-calendar-api,google-meet,Java,Google Calendar Api,Google Meet,如何在java中的google日历api中添加google meet? 请帮帮我。我还没有理解谷歌的文档。 . 这里给出了源代码。在这里,我想使用用户gmail帐户创建事件。我没有任何G-suite帐户 Event事件=新事件() .setSummary(标题) .setLocation(位置) .setDescription(描述); DateTime startDateTime=新的日期时间(日期+“T”+开始时间+“+06:00”)//“2020-05-05T11:00:00+06:00”
Event事件=新事件()
.setSummary(标题)
.setLocation(位置)
.setDescription(描述);
DateTime startDateTime=新的日期时间(日期+“T”+开始时间+“+06:00”)//“2020-05-05T11:00:00+06:00”);
EventDateTime开始=新的EventDateTime()
.setDateTime(startDateTime)
.设定时区(“亚洲/达卡”);
event.setStart(启动);
DateTime endDateTime=新的日期时间(日期+T+endTime+06:00)//“2020-05-05T12:00:00+06:00”);
EventDateTime end=新的EventDateTime()
.setDateTime(endDateTime)
.设定时区(“亚洲/达卡”);
event.setEnd(end);
字符串[]递归=新字符串[]{“RRULE:FREQ=DAILY;COUNT=1”};
event.setRecurrence(Arrays.asList(recurrence));
活动参与者[];
Attendes=新的EventAttendee[allAttendees.size()];
对于(int i=0;iAnswer)
您将需要使用谷歌日历
您必须创建一个新的会面请求,然后将其附加到当前事件,在此之前,通过将conferenceDataVersion设置为1来启用它。在使用以下代码之前,请确保您具有此功能
代码
工具书类
最重要的下面给出了我的最终可行代码
Event event = new Event()
.setSummary(title)
.setLocation(location)
.setDescription(description);
DateTime startDateTime = new DateTime( date +"T"+startTime+"+06:00" );//"2020-05-05T11:00:00+06:00");
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("Asia/Dhaka");
event.setStart(start);
DateTime endDateTime = new DateTime(date +"T"+endTime+"+06:00");//"2020-05-05T12:00:00+06:00");
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("Asia/Dhaka");
event.setEnd(end);
String[] recurrence = new String[] {"RRULE:FREQ=DAILY;COUNT=1"};
event.setRecurrence(Arrays.asList(recurrence));
/* s1 = "abc@gmail.com";
s2 = "xyz@gmail.com";
EventAttendee[] attendees = new EventAttendee[] {
new EventAttendee().setEmail(s1),
new EventAttendee().setEmail(s2),
};*/
EventAttendee attendees[];
attendees = new EventAttendee[allAttendees.size()];
for(int i=0; i<allAttendees.size(); i++){
// System.out.println(allAttendees.get(i));
attendees[i] = new EventAttendee().setEmail(allAttendees.get(i));
}
event.setAttendees(Arrays.asList(attendees));
EventReminder[] reminderOverrides = new EventReminder[] {
new EventReminder().setMethod("email").setMinutes(24 * 60),
new EventReminder().setMethod("popup").setMinutes(10),
};
Event.Reminders reminders = new Event.Reminders()
.setUseDefault(false)
.setOverrides(Arrays.asList(reminderOverrides));
event.setReminders(reminders);
ConferenceSolutionKey conferenceSKey = new ConferenceSolutionKey();
conferenceSKey.setType("hangoutsMeet"); // Non-G suite user
CreateConferenceRequest createConferenceReq = new CreateConferenceRequest();
createConferenceReq.setRequestId("3whatisup3"); // ID generated by you
createConferenceReq.setConferenceSolutionKey(conferenceSKey);
ConferenceData conferenceData = new ConferenceData();
conferenceData.setCreateRequest(createConferenceReq);
event.setConferenceData(conferenceData);
String calendarId = "primary";
try {
event = service.events().insert(calendarId, event).setConferenceDataVersion(1).execute();
} catch (IOException e) {
e.printStackTrace();
}
System.out.printf("Event created: %s\n", event.getHtmlLink());
System.out.printf("Hangout Link %s\n", event.getHangoutLink());
Event事件=新事件()
.setSummary(标题)
.setLocation(位置)
.setDescription(描述);
DateTime startDateTime=新的日期时间(日期+“T”+开始时间+“+06:00”);/“2020-05-05T11:00:00+06:00”);
EventDateTime开始=新的EventDateTime()
.setDateTime(startDateTime)
.设定时区(“亚洲/达卡”);
event.setStart(启动);
DateTime endDateTime=新的日期时间(日期+T+endTime+06:00)//“2020-05-05T12:00:00+06:00”);
EventDateTime end=新的EventDateTime()
.setDateTime(endDateTime)
.设定时区(“亚洲/达卡”);
event.setEnd(end);
字符串[]递归=新字符串[]{“RRULE:FREQ=DAILY;COUNT=1”};
event.setRecurrence(Arrays.asList(recurrence));
/*s1=”abc@gmail.com";
s2=”xyz@gmail.com";
EventAttendee[]与会者=新的EventAttendee[]{
新建EventAttendee().setEmail(s1),
新建EventAttendee().setEmail(s2),
};*/
活动参与者[];
Attendes=新的EventAttendee[allAttendees.size()];
对于(int i=0;iHi!如果您提供一些您已经编写的代码,这将非常有帮助。如果我使用了以下依赖项。实现('com.google.api client:google api client android:1.23.0'){exclude group:'org.apache.httpcomponents'}实现('com.google.api:googleapi服务日历:v3-rev305-1.23.0'){exclude group:'org.apache.httpcomponents'}你能更详细地描述一下你遇到了什么错误吗?是的,兄弟。你的代码正在运行。非常感谢。愿上帝保佑你。很高兴能提供帮助!出于文档目的,如果可以的话,请接受对你有帮助的答案-它也能帮助其他将来有同样问题的人找到解决方案。如果你解释一下,那会很有帮助ned为什么这对你来说是一个解决方案,你需要做什么。因此像我这样的人稍后会看到你的代码。上面的代码对我来说是一个解决方案,因为我想在创建日历事件时创建Google meet链接。通过使用此代码,Google meet链接成功地创建了日历事件。
Event event = new Event()
.setSummary(title)
.setLocation(location)
.setDescription(description);
DateTime startDateTime = new DateTime( date +"T"+startTime+"+06:00" );//"2020-05-05T11:00:00+06:00");
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("Asia/Dhaka");
event.setStart(start);
DateTime endDateTime = new DateTime(date +"T"+endTime+"+06:00");//"2020-05-05T12:00:00+06:00");
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("Asia/Dhaka");
event.setEnd(end);
String[] recurrence = new String[] {"RRULE:FREQ=DAILY;COUNT=1"};
event.setRecurrence(Arrays.asList(recurrence));
/* s1 = "abc@gmail.com";
s2 = "xyz@gmail.com";
EventAttendee[] attendees = new EventAttendee[] {
new EventAttendee().setEmail(s1),
new EventAttendee().setEmail(s2),
};*/
EventAttendee attendees[];
attendees = new EventAttendee[allAttendees.size()];
for(int i=0; i<allAttendees.size(); i++){
// System.out.println(allAttendees.get(i));
attendees[i] = new EventAttendee().setEmail(allAttendees.get(i));
}
event.setAttendees(Arrays.asList(attendees));
EventReminder[] reminderOverrides = new EventReminder[] {
new EventReminder().setMethod("email").setMinutes(24 * 60),
new EventReminder().setMethod("popup").setMinutes(10),
};
Event.Reminders reminders = new Event.Reminders()
.setUseDefault(false)
.setOverrides(Arrays.asList(reminderOverrides));
event.setReminders(reminders);
ConferenceSolutionKey conferenceSKey = new ConferenceSolutionKey();
conferenceSKey.setType("hangoutsMeet"); // Non-G suite user
CreateConferenceRequest createConferenceReq = new CreateConferenceRequest();
createConferenceReq.setRequestId("3whatisup3"); // ID generated by you
createConferenceReq.setConferenceSolutionKey(conferenceSKey);
ConferenceData conferenceData = new ConferenceData();
conferenceData.setCreateRequest(createConferenceReq);
event.setConferenceData(conferenceData);
String calendarId = "primary";
try {
event = service.events().insert(calendarId, event).setConferenceDataVersion(1).execute();
} catch (IOException e) {
e.printStackTrace();
}
System.out.printf("Event created: %s\n", event.getHtmlLink());
System.out.printf("Hangout Link %s\n", event.getHangoutLink());