簡體   English   中英

如何在 Google 日歷 API 中創建事件,並在 C# 中的 Google Meet 中進行視頻會議?

[英]How to create event in Google Calendar API with videoconference in Google Meet in C#?

我正在嘗試使用此代碼使用 C# 創建 object 事件,三個月前它起作用了,我創建了事件但現在不起作用,我意識到程序集有一個新參數“事件類型”但我不知道它是否影響我的 object 事件


            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]原因[無效]域[全局]”

使用新會議數據創建活動時。 您只需指定createRequest字段,並將所有事件修改請求的ConferenceDataVersion請求參數設置為1

嘗試這個:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM