使用api插入的Google日历活动不会打印

问题描述 投票:0回答:1

使用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,"[email protected]").Execute();

这是我查看和打印日历时看到的复合屏幕截图。 https://i.stack.imgur.com/8FqAk.png

c# google-api google-calendar-api google-api-dotnet-client
1个回答
0
投票

我能够解决这个问题,但它真的只是一个概念证明,所以我没有我回顾的代码。我记得它的问题最终成了我用作endDate的值。我不记得细节,但也许我使用与startDate相同的日期并添加了午夜的结束时间。无论如何都是这样的。祝你好运,对不起,我无能为力。

© www.soinside.com 2019 - 2024. All rights reserved.