我正在尝试在 .NET 中使用 Google Calendar API,特别是我正在尝试获取事件列表。根据此处的示例,在不同的编程语言中,我需要创建一个“服务”对象和一个“事件”对象。但是,我找不到关于这些对象是什么或如何启动它们的清晰解释。有人有解释吗?或者任何人都可以提供任何信息或给我一个链接到解释的地方吗?它不一定必须在 .NET 中
这是Java中的示例:
String pageToken = null;
do {
events = service.events().list('primary').setPageToken(pageToken).execute();
List<Event> items = events.getItems();
for (Event event : items) {
System.out.println(event.getSummary());
}
pageToken = events.getNextPageToken();
} while (pageToken != null);
按照已回答的建议,我收到以下错误:
Could not load file or assembly 'Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
下面是代码,出现错误就credentials = Await...
行了
Dim credential As UserCredential
Dim clientSecretsPath As String = Server.MapPath("~/App_Data/client_secret.json")
Dim scopes As IList(Of String) = New List(Of String)()
scopes.Add(CalendarService.Scope.Calendar)
Using stream = New System.IO.FileStream(clientSecretsPath, System.IO.FileMode.Open, System.IO.FileAccess.Read)
credential = Await GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, scopes, "user", CancellationToken.None)
End Using