日历 API - 使用日历 API v3 C# 库设置quotaUser 参数
我们的应用程序是使用域范围内委托执行请求对API进行日历。 直到某个时候,我们对此没有任何问题(我们在开发计算机中仍然没有问题),但是现在从我们的服务器上进行的请求需要几分钟的时间才能服务。我找到了通过设置 quotauser url参数。我们正在使用日历API V3 C#库,我们试图将Quotauser设置为任意字符串(请参见下面的代码)。不幸的是,这尚未解决问题。任何帮助将不胜感激。
var listOfUsersEmails = //someListOfEmails;
CalendarService service = GetCalendarService("credentials.json", gSuiteAdminEmail);
var events = new Events();
events.Items = new List<Event>();
var request = new BatchRequest(service);
foreach (var userEmail in listOfUsersEmails)
{
var r = service.Events.List(userEmail);
r.TimeMin = //today's beginning;
r.TimeMax = //today's end
r.ShowDeleted = false;
r.SingleEvents = true;
r.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;
// this is what we've tried
r.QuotaUser = userEmail.Substring(0,40);
//
request.Queue<Events>(
r,
(content, error, i, message) =>
{
if (content != null && content.Items != null)
{
foreach (var f in content.Items)
{
events.Items.Add(f);
}
}
});
}
await request.ExecuteAsync();
return events;
Our application is performing requests to Calendar API using domain-wide delegation.
We had no problem with that until sometime ago (and we still have no problem in our development computer), but now requests proceeding from our server are taking several minutes to be served, if at all. I’ve found this page explaining the problem and how to solve it by setting the quotaUser URL parameter. We’re using Calendar API v3 C# library and we’ve tried to simply set quotaUser to an arbitrary string (see code below). Unfortunately this has not solved the problem. Any help would be deeply appreciated.
var listOfUsersEmails = //someListOfEmails;
CalendarService service = GetCalendarService("credentials.json", gSuiteAdminEmail);
var events = new Events();
events.Items = new List<Event>();
var request = new BatchRequest(service);
foreach (var userEmail in listOfUsersEmails)
{
var r = service.Events.List(userEmail);
r.TimeMin = //today's beginning;
r.TimeMax = //today's end
r.ShowDeleted = false;
r.SingleEvents = true;
r.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;
// this is what we've tried
r.QuotaUser = userEmail.Substring(0,40);
//
request.Queue<Events>(
r,
(content, error, i, message) =>
{
if (content != null && content.Items != null)
{
foreach (var f in content.Items)
{
events.Items.Add(f);
}
}
});
}
await request.ExecuteAsync();
return events;
Here is the screenshot that @Daniel asked for (see comments below):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论