【发布时间】:2018-10-20 15:55:35
【问题描述】:
使用 google 的 api 和服务帐户插入的事件在我查看日历时显示正常,但在我打印日历时它们不包括在内。
手动插入的事件按预期打印。我正在使用以下代码。
string[] scopes = new string[] { CalendarService.Scope.Calendar };
GoogleCredential credential;
using (var stream = new FileStream("mikeServiceAccount.json", FileMode.Open,
FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream).CreateScoped(scopes);
}
// Create the Calendar service.
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Calendar Authentication Sample",
});
Event myEvent = new Event
{
Summary = "Summary Title",
Description = "event description"
Location = "Nashville, TN"
Start = new EventDateTime()
{
Date = "2018-10-19"
},
End = new EventDateTime()
{
Date = "2018-10-19"
}
};
service.Events.Insert(myEvent,"b4sbsrsdf9r82sbj0@group.calendar.google.com").Execute();
这是我查看和打印日历时看到的合成屏幕截图。 https://i.stack.imgur.com/8FqAk.png
【问题讨论】:
-
打印日历是什么意思?
-
我看到所有事件只是查看日历,但是当我点击 ctrl-p 时,我只能看到打印预览屏幕中手动添加的事件。我有屏幕截图。让我看看是否可以将它们添加到我的问题中。谢谢!
-
然后请包含您的打印屏幕代码
-
使用的 c# 代码是我在最初的帖子中包含的。这是屏幕截图本身的链接。 i.stack.imgur.com/8FqAk.png
-
您发布的代码中包含任何用于打印的内容。
标签: c# google-api google-calendar-api google-api-dotnet-client