【发布时间】:2016-07-01 08:53:50
【问题描述】:
使用服务帐户检索日历中的事件时出现以下错误。
谁能告诉我我做错了什么。
未找到 Google.Apis.Requests.RequestError [404] 错误 [消息 [未找到] 位置 [-] 原因 [未找到] 域 [全局]] //文件路径 string GoogleOAuth2CertificatePath = Server.MapPath("GoogleStore\My Project-a725fb0190fc.p12");
// @developer... e-mail address.
string GoogleOAuth2EmailAddress = "939544675132-compute@developer.gserviceaccount.com";
// certificate password ("notasecret").
string GoogleOAuth2PrivateKey = "notasecret";
X509Certificate2 certificate = new X509Certificate2(GoogleOAuth2CertificatePath, GoogleOAuth2PrivateKey, X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(GoogleOAuth2EmailAddress)
{
Scopes = new[] { CalendarService.Scope.Calendar }
}.FromCertificate(certificate));
// Create the service.
service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName
});
ListRequest request = service.Events.List(calID);
request.ShowDeleted = false;
request.SingleEvents = true;
events = request.Execute();
感谢您对我有帮助的任何回答。
【问题讨论】:
标签: google-calendar-api service-accounts