簡體   English   中英

發送有關Google日歷活動刪除的通知

[英]Send notification on google calendar event delete

我想在刪除事件時發送通知:

var certificate = new X509Certificate2("myp12filepath", "notasecret", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);

ServiceAccountCredential credential = new ServiceAccountCredential(
    new ServiceAccountCredential.Initializer(serviceAccountEmail)
    {
        Scopes = Scopes
    }.FromCertificate(certificate));

BaseClientService.Initializer initializer = new BaseClientService.Initializer();
initializer.HttpClientInitializer = credential;
initializer.ApplicationName = ApplicationName;
var service1 = new CalendarService(initializer);

var googleCalendarEvent = service1.Events.Delete("calendarId", "eventId").Execute();

刪除功能不接受此鏈接中提到的第三個參數(指示是否發送通知)(沒有c#示例)

那么,有什么方法可以在刪除事件后發送電子郵件通知?

創建刪除請求的實例,並將通知分配為true。 見下文。

var certificate = new X509Certificate2("myp12filepath", "notasecret", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);

ServiceAccountCredential credential = new ServiceAccountCredential(
    new ServiceAccountCredential.Initializer(serviceAccountEmail)
    {
        Scopes = Scopes
    }.FromCertificate(certificate));

BaseClientService.Initializer initializer = new BaseClientService.Initializer();
initializer.HttpClientInitializer = credential;
initializer.ApplicationName = ApplicationName;
var service1 = new CalendarService(initializer);

EventsResource.DeleteRequest delReq = service1.Events.Delete("calendarId", "eventId");
delReq.SendNotifications = true;
var googleCalendarEvent = delReq.Execute();

AFAIK,如果要發送有關事件刪除的通知,則需要將sendNotifications設置為true ,這在給定鏈接中也提到了。 除此之外,為使用戶接收通知,還應按照本論壇中提到的以及此處給出的每個日歷檢查用戶的通知設置。

下面列出了打開或關閉通知的步驟:

您可以選擇是否具有事件通知,以及是否要通過電子郵件或在瀏覽器中獲取通知。

  1. 在計算機上打開Google日歷
  2. 點擊右上角的設置(齒輪圖標) >設置
  3. 在頁面頂部,單擊日歷選項卡。
  4. 在日歷名稱旁邊,點擊編輯通知
  5. 單擊添加通知或編輯現有通知。
  6. 在頁面底部,點擊保存

注意 :要在計算機上獲取通知,您需要在瀏覽器中打開Goog​​le日歷。

最后,由於沒有太多的C#示例, .NET客戶端可能會有所幫助。

暫無
暫無

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

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