Google calendar api 在服务帐户中执行请求时未找到异常
使用服务帐户检索日历事件时,我遇到以下错误 谁能告诉我我做错了什么 Google.API.Requests.RequestError未找到[404]错误[消息[未找到]位置[-]原因[未找到]域[全局]] //文件路径 字符串GoogleOAuth2CertificatePath=Server.MapPath(“GoogleStore\My Project-a725fb0190fc.p12”)Google calendar api 在服务帐户中执行请求时未找到异常,google-calendar-api,service-accounts,Google Calendar Api,Service Accounts,使用服务帐户检索日历事件时,我遇到以下错误 谁能告诉我我做错了什么 Google.API.Requests.RequestError未找到[404]错误[消息[未找到]位置[-]原因[未找到]域[全局]] //文件路径 字符串GoogleOAuth2CertificatePath=Server.MapPath(“GoogleStore\My Project-a725fb0190fc.p12”) 感谢您提供的任何有助于我的答案。通常在遇到404:Not found指定的资源未找到时。这可能发生在几
感谢您提供的任何有助于我的答案。通常在遇到
404:Not found
指定的资源未找到时。这可能发生在几种情况下
- 当请求的资源从未存在时
- 访问用户无法访问的日历时
404未找到
错误:
// @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();