【问题标题】:How to create event in Google Calendar API with videoconference in Google Meet in C#?如何在 C# 中的 Google Meet 中通过视频会议在 Google Calendar API 中创建事件?
【发布时间】:2021-02-05 05:18:42
【问题描述】:

我正在尝试这段代码使用 C# 创建对象事件, 三个月前它起作用了,我创建了事件,但现在不起作用,我意识到程序集有一个新参数“事件类型”,但我不知道它是否会影响我的对象事件


            Event calendarEvent = new Event();
            DateTime start = DateTime.Now;
            calendarEvent.Kind = "";
            calendarEvent.Summary = "test";
            calendarEvent.Status = "confirmed";
            calendarEvent.Visibility = "public";
            calendarEvent.Description = "test";
           
            calendarEvent.Creator = new Event.CreatorData
            {
                Email= "email@example.com",
                Self=true
            };

            calendarEvent.Organizer = new Event.OrganizerData
            {
                Email = "email@example.com",
                Self = true
            };

            calendarEvent.Start = new EventDateTime
            {
                DateTime = start,
                TimeZone = "America/Mexico_City"
            };

            calendarEvent.End = new EventDateTime
            {
                DateTime = start.AddHours(1),
                TimeZone = "America/Mexico_City"
            };

            calendarEvent.Recurrence = new String[] {"RRULE:FREQ=DAILY;COUNT=1" };
            calendarEvent.Sequence = 0;
            calendarEvent.HangoutLink = "";

            calendarEvent.ConferenceData = new ConferenceData
            {
                CreateRequest = new CreateConferenceRequest
                {
                    RequestId = "1234abcdef",
                    ConferenceSolutionKey = new ConferenceSolutionKey
                    {
                        Type = "hangoutsMeet"
                    },
                    Status = new ConferenceRequestStatus
                    {
                        StatusCode = "success"
                    }
                },
                EntryPoints = new List<EntryPoint>
                {
                    new EntryPoint
                    {
                        EntryPointType = "video",
                        Uri = "",
                        Label = ""
                    }
                },
                ConferenceSolution = new ConferenceSolution
                {
                    Key = new ConferenceSolutionKey
                    {
                       Type = "hangoutsMeet"
                    },
                    Name = "Google Meet",
                    IconUri = ""
                },
                ConferenceId = ""
            };

            //calendarEvent.EventType = "default";
          

执行创建事件的行时:

                EventsResource.InsertRequest request = service.Events.Insert(calendarEvent, "email@example.com");
                request.ConferenceDataVersion = 1;
                Event createdEvent = request.Execute();

我明白了:

Google.Apis.Requests.Request 错误 会议类型值无效。 [400] 原因[无效] 域[全局]"

【问题讨论】:

  • 你能把完整的代码一并分享吗?您似乎正在创建一个重复的 ConferenceSolutionKey。错误是否为您提供了错误所在的确切行?
  • 我正在尝试这个:
  • 我正在尝试这个:link,错误在第 116 行(Event createEvent = request.Execute();)你有什么例子可以在 GoogleMeet 中创建一个带有视频会议的事件吗?
  • 谢谢,但我不明白值 eventNamedHangout 的含义是什么,因为我使用 GCP 服务帐户凭据来创建事件

标签: c# .net google-api google-calendar-api google-api-dotnet-client


【解决方案1】:

使用新会议数据创建活动时。您只需指定 createRequest 字段,并将所有事件修改请求的 conferenceDataVersion 请求参数设置为 1

试试这个:

        calendarEvent.ConferenceData = new ConferenceData
        {
            CreateRequest = new CreateConferenceRequest
            {
                RequestId = "1234abcdef",
                ConferenceSolutionKey = new ConferenceSolutionKey
                {
                    Type = "hangoutsMeet"
                }
            },
        };

【讨论】:

  • 但是EntryPoints = new List&lt;EntryPoint&gt; { new EntryPoint { EntryPointType="video", Uri="", Label="" } } 发生了什么事情有必要吗?我试过了,但我得到了同样的错误
猜你喜欢
  • 2021-07-04
  • 2021-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多