如何在C#的Google Meet中通过视频会议在Google Calendar API中创建事件? [英] How to create event in Google Calendar API with videoconference in Google Meet in C#?

查看:173
本文介绍了如何在C#的Google Meet中通过视频会议在Google Calendar API中创建事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying this code to create object Event using C#, three month ago its worked and I created the events but now doesn't work, I realized that assembly has a new parameter "Event Type" but I don't know if It affects my object event


            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";
          

在执行以下操作以创建事件时:

When excute the line to create the event:

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

我得到:

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

Google.Apis.Requests.Request Error Invalid conference type value. [400] Reason[invalid] Domain[global]"

推荐答案

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

When creating an event with a new conference data. You just need to specify the createRequest field, and set the conferenceDataVersion request parameter to 1 for all event modification requests.

尝试一下:

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

这篇关于如何在C#的Google Meet中通过视频会议在Google Calendar API中创建事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆