Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将事件添加到Google日历所需的要求?_Java_Google Data Protocol - Fatal编程技术网

Java 将事件添加到Google日历所需的要求?

Java 将事件添加到Google日历所需的要求?,java,google-data-protocol,Java,Google Data Protocol,我需要在不使用IDE的情况下将事件添加到google日历表单Java中。开发我的应用程序需要什么要求。要做到这一点,需要任何API吗?需要知道如何在Java中使用该API。现在我只有JDK1.6。有人能帮我做这件事吗 您可以使用,将JAR包含在您的项目中并使用这些: import com.google.gdata.client.*; import com.google.gdata.client.calendar.*; import com.google.gdata.data.*; import

我需要在不使用IDE的情况下将事件添加到google日历表单Java中。开发我的应用程序需要什么要求。要做到这一点,需要任何API吗?需要知道如何在Java中使用该API。现在我只有JDK1.6。有人能帮我做这件事吗

您可以使用,将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;
要创建新的日历事件,可以使用以下代码:

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);
资料来源: