我尝试使用此处的指南获取通知. https://developers.google.com/gmail/api/guides/push#gmail_watch
Gmail服务(服务)可以获取标签,收件箱和其他API功能.
这是代码.
var service = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
IList<string> label = new List<string>();
label.Add("INBOX");
WatchRequest request2 = new WatchRequest
{
LabelIds = label,
LabelFilterAction = "include",
TopicName = "projects/******/topics/****TestTopic"
};
var x= service.Users.Watch(request2, "me").Execute();
Run Code Online (Sandbox Code Playgroud)
Watch抛出这个例外
Google.Apis.Requests.RequestError
Backend Error [500]
Errors [
Message[Backend Error] Location[ - ] Reason[backendError] Domain[global]
]
Run Code Online (Sandbox Code Playgroud)