簡體   English   中英

超出 Google Calendar Api v3 配額

[英]Google Calendar Api v3 quota exceeded

我在創建日歷事件(使用 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();

如果我嘗試在沒有與會者的情況下執行代碼,它會運行而不會出現任何錯誤。

以前有人遇到過這個問題嗎?

這是一個已知錯誤

它已在問題跟蹤器上報告。 您可以單擊問題編號旁邊的星號以給予錯誤更高的優先級並接收更新。


但是,這有當前的解決方法(除了不包括與會者):

域范圍委派模擬用戶

您可以在此處閱讀有關如何操作的信息,步驟如下:

  1. 在表中找到新創建的服務帳戶。 在操作下,單擊顯示更多,然后單擊編輯。
  2. 在服務帳戶詳細信息中,單擊顯示域范圍委派,然后確保選中啟用 G Suite 域范圍委派復選框。
  3. 如果您尚未配置應用的 OAuth 同意屏幕,則必須先配置,然后才能啟用域范圍委派。 按照屏幕上的說明配置 OAuth 同意屏幕,然后重復上述步驟並重新選中復選框。
  4. 單擊保存以更新服務帳戶,並返回到服務帳戶表。 可以看到一個新列,域范圍委派。 單擊查看客戶端 ID,獲取並記錄客戶端 ID。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM