简体   繁体   English

向Google日历添加活动所需的条件?

[英]Requirements needed for adding events to Google Calendar?

I need to add events to google calendar form Java without using IDE. 我需要在不使用IDE的情况下向Google日历表单Java添加事件。 What are the requirements are needed to develop my application. 开发我的应用程序需要什么要求。 Any API is needed to do that? 需要任何API来做到这一点吗? Is it needed how to use that API in Java. 是否需要在Java中使用该API? Now I have JDK 1.6 only. 现在我只有JDK 1.6。 Can anyone help me to do this? 谁能帮我做到这一点?

You can use Google Data Java Client Library , include the JAR in your projects and use these: 您可以使用Google Data Java Client Library ,在您的项目中包含JAR并使用以下这些:

import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.URL;

To create a new calendar event, you might use the following code: 要创建一个新的日历事件,您可以使用以下代码:

URL postUrl =
  new URL("http://www.google.com/calendar/feeds/liz@gmail.com/private/full");
EventEntry myEntry = new EventEntry();

myEntry.setTitle(new PlainTextConstruct("Tennis with Darcy"));
myEntry.setContent(new PlainTextConstruct("Meet for a quick lesson."));

Person author = new Person("Elizabeth Bennet", null, "liz@gmail.com");
myEntry.getAuthors().add(author);

DateTime startTime = DateTime.parseDateTime("2006-04-17T15:00:00-08:00");
DateTime endTime = DateTime.parseDateTime("2006-04-17T17:00:00-08:00");
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);

// Send the request and receive the response:
EventEntry insertedEntry = myService.insert(postUrl, myEntry);

Source: http://code.google.com/apis/gdata/client-java.html 来源: http : //code.google.com/apis/gdata/client-java.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM