When I try to use getReminder().add() function to add a Reminder to a
calendar entry, it results in no reminder being added to the calendar
entry. Here is the program that demonstrates the problem:
<xmp>
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.calendar.CalendarEventEntry;
import com.google.gdata.data.extensions.Reminder;
import com.google.gdata.data.extensions.Reminder.Method;
import com.google.gdata.util.ServiceException;
import java.net.URL;
public class AddEntry {
private static final String METAFEED_URL_BASE = "http://
www.google.com/calendar/feeds/";
private static final String EVENT_FEED_URL_SUFFIX = "/private/full";
private static URL metafeedUrl = null;
private static URL eventFeedUrl = null;
private static CalendarEventEntry addEvent(CalendarService service,
String quickAddContent) throws Exception {
CalendarEventEntry myEntry = new CalendarEventEntry();
myEntry.setContent(new PlainTextConstruct(quickAddContent));
myEntry.setQuickAdd(true);
// Send the request and receive the response:
myEntry = service.insert(eventFeedUrl, myEntry);
Reminder reminder = new Reminder();
reminder.setHours(12);
reminder.setMethod(Method.EMAIL);
myEntry.getReminder().add(reminder);
return myEntry.update();
}
public static void main(String args[]) throws Exception {
if (args.length != 2) {
System.out.println("AddEvent <user> <pw>");
return;
}
String userName = args[0];
String userPassword = args[1];
// Create the necessary URL objects.
metafeedUrl = new URL(METAFEED_URL_BASE + userName);
eventFeedUrl = new URL(METAFEED_URL_BASE + userName +
EVENT_FEED_URL_SUFFIX);
CalendarService myService = new CalendarService("running");
myService.setUserCredentials(userName, userPassword);
CalendarEventEntry event = addEvent(myService,
"Run 10 miles with Brian July 21 6am-7:30am");
}
}
</xmp>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---