通过API创建的事件未在打印中列出 [英] Events created via API are not listed in printing

查看:47
本文介绍了通过API创建的事件未在打印中列出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用我的gmail帐户创建了一个Google日历,并且希望在我的网站上显示该日历.

I have created one google calendar with my gmail account and I want to display that calendar in my website.

与该日历有关的所有事件均使用.Net库通过Google日历API插入.

All Events related to that calender's are inserted via google calendar API using .Net Library.

它显示网站上的所有事件.但是当我单击打印时,所有事件都不会显示在打印预览中.

It shows all events in website.but when i click on print and all events are not display in print preview.

调用插入事件API时是否缺少任何参数?

Is there any parameter missing while calling Insert Event API?

推荐答案

我在Chrome扩展程序中创建的事件遇到了此问题.我将为您保留令牌的代码,但我认为创建事件没有任何问题,但拒绝打印就足够了.

I was having this problem with events created in a Chrome Extension. I'll spare you the code for the token, but I think it's enough that the event is created without any problems, yet refuses to print.

期望的行为:创建可以打印的事件. 特定错误:事件已创建,但无法打印. 代码:

Desired behaviour: create event that can be printed. Specific Error: event is created, but can not be printed. Code:

var copyInit = {
                            'method': 'POST',
                            'async': true,
                            'headers': {
                                'Authorization': 'Bearer ' + Items.access_token,
                                'Content-Type': 'application/json'
                            },
                            'contentType': 'json',
                            'body': dataJson
                        };

dataJson:

"{"start":{"date":"2019-04-22"},"end":{"date":"2019-04-22"},"summary":"test"}"

API调用:

            var url = 'https://www.googleapis.com/calendar/v3/calendars/' + calId + '/events?key=AIzaSyDfX9-blah9KoxzvGu3IzA1zu0oDQ-cJfw';
        fetch(url, copyInit)

经过长时间的摸索,事实证明,尽管Google Calendar API允许您使用全天事件的相同开始日期和结束日期来创建全天事件(使用YYYY-MM-DD),但此类事件无法打印,并且共享时的结束日期早于开始日期...

After much head scratching it turns out that although the Google Calendar API allows you to create all day events using the same start date and end date for all day events (using YYYY-MM-DD), such events can not be printed, and when shared will have an end date previous to the start date...

解决方案是将第二天用作全天活动的结束日期:

The solution is to use the following day as the end date for all day events:

"{"start":{"date":"2019-04-22"},"end":{"date":"2019-04-23"},"summary":"works!"}"

这篇关于通过API创建的事件未在打印中列出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆