0
我已成功使用Google Calendar API的Java .jar文件创建日历条目。尽管我有以下所示的日历,但他们总是会进入“步枪”日历。我需要知道如何指定条目所属的日历。例如,我将在何处指定“会议”或“散弹枪”使用Java API创建日历条目时选择特定的日历
我没有看到任何指示特定日历的任何示例。
public void create() {
try {
CalendarService myService = new CalendarService("My Service");
myService.setUserCredentials("mycalendar", "mypassword");
URL postUrl = new URL("http://www.google.com/calendar/feeds/[email protected]/private/full");
CalendarEventEntry myEntry = new CalendarEventEntry();
//myEntry.setIcalUID("Rec Fire");
DateTime startTime = DateTime.parseDateTime("2014-06-22T09:00:00");
DateTime endTime = DateTime.parseDateTime("2014-06-22T13:00:00");
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
Where eventLocation = new Where();
eventLocation.setLabel("R-4");
eventLocation.setValueString("value string");
eventLocation.setRel("REL");
myEntry.addLocation(eventLocation);
EventWho eventWho = new EventWho();
eventWho.setAttendeeStatus("attendee status");
eventWho.setAttendeeType("Meetings");
eventWho.setValueString("who value string");
eventWho.setEmail("[email protected]");
eventWho.setRel("who rel");
myEntry.addParticipant(eventWho);
myEntry.setTitle(new PlainTextConstruct("R-4 Rifles Only"));
myEntry.setContent(new PlainTextConstruct("Paragraph HURST MULLINS"));
CalendarEventEntry insertedEntry = myService.insert(postUrl, myEntry);
} catch (Exception e) {
e.printStackTrace();
}
它帮助,如果你发布你使用的是创建日历条目的代码,所以我们可以找出什么在改变它。对于一般示例,您需要转到[Google文档(已链接)](https://developers.google.com/google-apps/calendar/v2/developers_guide_java#CreatingEvents) –