简体   繁体   中英

Google calendar events insert

going out of my mind and hope for some insight-i am inserting an event by way of google javascript and all day event does not seem to want to work-can easily do a single non all day event, but seems as though "date" doesnt work

var strttime = new Date('[@scheduledfor]');

var endtie = new Date('[@scheduledfortime]');
var endtie2 = new Date('2016-12-01');   
var endtie3 = new Date('2016-12-01');      

    var request = gapi.client.calendar.events.insert({
        calendarId: 'cal is correct',

            start:{
            date:new Date('2016-12-11')
},
            end:{
            date:new Date('2016-12-11')

},

any help is appreciated-like i said if i change date to dateTime works no problem, but as soon as i call for date for all day it breaks and returns global not found -even works in the try it of google, have tried end.date, set.start, any help is greatly appreciated

as a result of an answer i have tried this and it doen not work either-returns 404-i have tried before this although will post now

var endtie2 = new Date('2016-12-13');   
var endtie3 = new Date('2016-12-13');          

var request = gapi.client.calendar.events.insert({
        calendarId: 'a good calendar',
        start: {
        date: [endtie3],
        timeZone: 'America/New_York'},
        end: {
        date: [endtie3],
        timeZone: 'America/New_York'},

Try referring to the events.insert sample and the Javascript quickstart from the docs:

// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/google-apps/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.

var event = {
  'summary': 'Google I/O 2015',
  'location': '800 Howard St., San Francisco, CA 94103',
  'description': 'A chance to hear more about Google\'s developer products.',
  'start': {
    'dateTime': '2015-05-28T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'end': {
    'dateTime': '2015-05-28T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'recurrence': [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  'attendees': [
    {'email': 'lpage@example.com'},
    {'email': 'sbrin@example.com'}
  ],
  'reminders': {
    'useDefault': false,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10}
    ]
  }
};

var request = gapi.client.calendar.events.insert({
  'calendarId': 'primary',
  'resource': event
});

request.execute(function(event) {
  appendPre('Event created: ' + event.htmlLink);
});

在Google日历中插入活动时,有必要提及开始和结束时间的时区。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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