Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用新房间在服务帐户中执行请求时未发现异常_C#_Google Api_Google Calendar Api_Google Api Dotnet Client - Fatal编程技术网

C# 使用新房间在服务帐户中执行请求时未发现异常

C# 使用新房间在服务帐户中执行请求时未发现异常,c#,google-api,google-calendar-api,google-api-dotnet-client,C#,Google Api,Google Calendar Api,Google Api Dotnet Client,我创建了一个新的资源(房间),并尝试将其与我开发的用于列出房间事件的软件一起使用 GoogleCredential credential; string[] scopes = new string[] { CalendarService.Scope.Calendar, CalendarService.Scope.CalendarReadonly }; using (var stream = new FileStream(filePath, FileMode.

我创建了一个新的资源(房间),并尝试将其与我开发的用于列出房间事件的软件一起使用

 GoogleCredential credential;
 string[] scopes = new string[] { CalendarService.Scope.Calendar, CalendarService.Scope.CalendarReadonly };
 using (var stream =
                new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                credential = GoogleCredential.FromStream(stream)
                        .CreateScoped(scopes);
            }

            // Create Google Calendar API service.
            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Calendar-Project"
            });


            EventsResource.ListRequest request = service.Events.List(googleID);
            Events eventsg = request.Execute();

            .......
使用新房间的日历ID,我得到错误“未找到”…旧房间工作正常

日历ID是正确的(我确定)

我注意到它与“旧房间”的ID不同:

旧ID:xxxxxxxxx.it_1884b9j7r3nr4gbanborb21m3jj8i6ga74oj2chh6so34chm@resource.calendar.google.com

新ID:xxxxxxxxx.it_1889krjg9ra36gtviaih6imjm9tpe@resource.calendar.google.com“未找到”错误通常意味着您试图访问一个您实际上无权访问的日历

如果您使用calendar.list,您可以查看您有权访问哪些日历,然后使用该日历代替您的googleId

您还可以使用术语primary来表示当前经过身份验证的用户的主日历。这也是他们的电子邮件地址

“未找到”错误通常意味着您试图访问一个您实际上无权访问的日历

如果您使用calendar.list,您可以查看您有权访问哪些日历,然后使用该日历代替您的googleId


您还可以使用术语primary来表示当前经过身份验证的用户的主日历。这也是他们的电子邮件地址

googlId是什么?您是否尝试过使用calendar.list查看您有权访问哪些日历?听起来你的服务帐户没有访问权限。你是如何创建房间及其日历的?你说的旧房间是什么意思?@DaImTo:你说得对!访问问题!谢谢你,古力?您是否尝试过使用calendar.list查看您有权访问哪些日历?听起来你的服务帐户没有访问权限。你是如何创建房间及其日历的?你说的旧房间是什么意思?@DaImTo:你说得对!访问问题!谢谢