javascript - 在节点 js 中获取谷歌日历事件 ID
问题描述
我正在尝试从 node.js 中的谷歌日历中删除一个事件,这需要一个 ID 才能删除该事件。
我没有找到任何方法在谷歌日历文档中获取此 ID。有没有办法使用特定方法获取事件 ID?
function deleteEvent(agent) {
console.log('delete event function');
//Check the availability of the time slot and set up an appointment if the time slot is available on the calendar
return getEventId().then(() => {
agent.add(`Got it. the event deleted`);
}).catch(() => {
agent.add(`Sorry`);
});
}
function getEventId(){
console.log("get event id function");
eventId='******';
return deleteCalendarEvent().then(()=>{
console.log('success');
}).catch(()=>{
console.log('fail');
});
}// getEmailsForDepartment
function deleteCalendarEvent(){
return new Promise((resolve, reject) => {
calendar.events.delete({
auth: serviceAccountAuth,
calendarId: calendarId,
eventId:eventId
}, (err, event) => {
err ? reject(err) : resolve(event);
});
});
}
解决方案
您可以使用Events: list
列出所有事件。然后按标题、日期或类似内容进行过滤以获取所需事件的 ID。请参阅 https://developers.google.com/calendar/v3/reference/events/list
在浏览器 UI 中,如果单击故障排除信息,您会看到 eid。
推荐阅读
- kubernetes - 如果发布大型 json,用于自动审查应用程序(gitlab-managed-apps)的入口 NGINX 非常慢
- ios - SwiftUI“线程1:EXC_BAD_INSTRUCTION(代码=EXC_I386_INVOP,子代码=0x0)”弹出时
- python - 将新项目添加到 Windows 上下文菜单(右键菜单)
- angular - 添加路由器存储配置 RouterState.Full 会引发神秘的错误消息
- java - java.lang.AssertionError:状态 404
- c++ - 不要使用静态转换进行算术转换(cpp-core-guidelines)
- javascript - 找不到变量 atob React Native+Firebase 错误
- oracle - 将 JSON 动态检索到数据表 ORacle 12c 版本 1
- powerbi - Power-Query/Power-Bi:仅当列类型存在时如何更改它们?
- postgresql - Postgres View,alter table 更改表名后,View 还在查询吗?