【问题标题】:Where to receive watch notifications for gmail in .NET?在哪里接收 .NET 中 gmail 的观看通知?
【发布时间】:2022-09-23 06:43:42
【问题描述】:

我正在尝试在我的 .NET C# 程序中接收 Gmail 邮箱的监视通知。

我有以下代码:

WatchRequest body = new WatchRequest()
{
    LabelIds = labelIds,
    TopicName = PrivateKeys.GoogleGmailTopic
};

WatchResponse response = new UsersResource.WatchRequest(_gmailService, body, \"me\")
{
    Key = PrivateKeys.GoogleApiKey,
    OauthToken = AccessToken
}
    .Execute();

...而且它似乎有效,因为我得到了回应。

在我的程序中哪里可以收到这些通知?如何配置事件入口点?

    标签: c# .net push-notification gmail-api google-cloud-pubsub


    【解决方案1】:

    假设您完成了设置 Cloud Pub/Sub 客户端的初步工作(在此处描述:https://developers.google.com/gmail/api/guides/push#initial_cloud_pubsub_setup),您应该有一个 Pub/Sub 订阅 - PULL 或 PUSH。

    为了获得通知,您的应用程序应该启动订阅者,您可以按照https://cloud.google.com/pubsub/docs/pull 中的说明进行 PULL 或 https://cloud.google.com/pubsub/docs/push 中的 PUSH。配置事件入口点应该作为订阅者设置的一部分来完成。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-15
      • 2010-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多