Update Event to google calendar using oauth2 and calendar Api v3 Java -
update the event google calendar using oauth2 , calendar api v3. cant find example. have insert , read event
event event = new event(); event.setsummary("my event"); event.setlocation("my event place here"); date startdate = new date(); date enddate = new date(startdate.gettime() + 3600000); datetime start = new datetime(startdate, timezone.gettimezone("utc")); event.setstart(new eventdatetime().setdatetime(start)); datetime end = new datetime(enddate, timezone.gettimezone("utc")); event.setend(new eventdatetime().setdatetime(end)); event createdevent = service.events().insert("primary", event) .execute(); system.out.println("created event id: " + createdevent.getid());
but have update event ?
works thanx give link @dalmto
import com.google.api.services.calendar.calendar; import com.google.api.services.calendar.model.event; // ... // initialize calendar service valid oauth credentials calendar service = new calendar.builder(httptransport, jsonfactory, credentials) .setapplicationname("applicationname").build(); // retrieve event api event event = service.events().get("primary", "eventid").execute(); // make change event.setsummary("appointment @ somewhere"); // update event event updatedevent = service.events().update("primary", event.getid(), event).execute(); system.out.println(updatedevent.getupdated());
Comments
Post a Comment