【发布时间】:2020-03-07 16:29:13
【问题描述】:
我在创建日历事件时遇到问题(使用 google 服务帐户),我启用了域范围委派。
我得到的错误是: "消息[超出日历使用限制。] 位置[-] 原因[quotaExceeded] 域[usageLimits]"
我检查了使用情况及其以下 10 个请求(配额设置为 1,000,000)
这是我的代码:
string[] Scopes = { CalendarService.Scope.Calendar, CalendarService.Scope.CalendarEvents };
using (var stream = new FileStream("cred.json", FileMode.Open, FileAccess.Read))
{
GoogleCredential credential = GoogleCredential.FromStream(stream)
.CreateScoped(Scopes);
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "TEST",
});
var ev = new Event();
EventDateTime start = new EventDateTime();
start.DateTime = DateTime.Now.AddMinutes(30);
EventDateTime end = new EventDateTime();
end.DateTime = DateTime.Now.AddMinutes(60);
ev.Start = start;
ev.End = end;
ev.Summary = "Test";
ev.Description = "Please Work";
ev.Attendees = new List<EventAttendee>
{
new EventAttendee() { Email = "TestMail@gmail.com" }
};
var calendarId = "primary";
service.Events.Insert(ev, calendarId).Execute();
如果我尝试在没有参与者的情况下执行代码,它运行时不会出现任何错误。
以前有人遇到过这个问题吗?
【问题讨论】:
-
@lulucode 我在poc阶段,我确定我没有超过配额,并且共享了太多次日历,它发生在我第一次发送api请求时
标签: c# asp.net-core google-calendar-api