将会议添加到活动 Google Calendar API

问题描述 投票:0回答:2

我可以创建活动,但无法创建带有会议的活动。

我尝试了所有这些类型:“eventHangout”“eventNamedHangout”“hangoutsMeet”但仍然得到会议类型值无效

Google.GoogleApiException: 'Google.Apis.Requests.RequestError
Invalid conference type value. [400]
Errors [
  Message[Invalid conference type value.] Location[ - ] Reason[invalid] Domain[global]
]

这是创建并执行事件的代码:

CalendarService service = GetCalendarService();

EventDateTime start = new EventDateTime();
start.DateTime = new DateTime(2021, 02, 19, 18, 47, 0);

EventDateTime end = new EventDateTime();
end.DateTime = new DateTime(2021, 02, 19, 18, 50, 0);

Event newEvent = new Event();
newEvent.Start = start;
newEvent.End = end;
newEvent.Summary = "New event";
newEvent.Description = "description";

newEvent.ConferenceData = CreateConferenceData();

EventsResource.InsertRequest request = service.Events.Insert(newEvent, calendarId);
request.ConferenceDataVersion = 1;
Event createdEvent = request.Execute();

这是CreateConferenceData()方法的代码:

 ConferenceData conferenceData = new ConferenceData()
 {
     CreateRequest = new CreateConferenceRequest()
     {
          RequestId = Guid.NewGuid().ToString(),
          ConferenceSolutionKey = new ConferenceSolutionKey()
          {
             Type = "hangoutsMeet" // Change according to your preferences
          };
     }
 };

 return conferenceData;
c# asp.net google-calendar-api google-api-dotnet-client
2个回答
1
投票

这是我的服务并且运作完美的会议活动

            _calenarService = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = GenerateCredentials(),
                ApplicationName = this._applicationName
            });


        var myEvent = new Event
        {
            Summary = "Google Calendar API Testing ",
            Location = "Islamabad, Punjab, Pakistan",
            Start = new EventDateTime()
            {
                DateTime = new DateTime(2021, 4, 5, 14, 0, 0),
                TimeZone = "Asia/Karachi"
            },
            End = new EventDateTime()
            {
                DateTime = new DateTime(2021, 9, 10, 15, 0, 0),
                TimeZone = "Asia/Karachi"
            },


            Recurrence = new String[] { "RRULE:FREQ=WEEKLY;BYDAY=MO" },
            //If you want to add attendee
            //Attendees = new List<EventAttendee>()
            //{
            //    new EventAttendee { Email = "......com" },
            //    new EventAttendee { Email = "......." }
            //},

           ConferenceData = new ConferenceData
            {
                ConferenceSolution = new ConferenceSolution
                {
                    Key = new ConferenceSolutionKey
                    {
                        Type = "hangoutsMeet"
                    }
                },

               CreateRequest = new CreateConferenceRequest
               {
                   RequestId = "qwerfsdiob",
                   ConferenceSolutionKey = new ConferenceSolutionKey
                   {
                       Type = "hangoutsMeet"
                   },

                  
               },

               EntryPoints = new List<EntryPoint> ()
                {
                    
                     new EntryPoint { EntryPointType = "video"  },
                  

                }
               
            }

            
        };

        var recurringEvent = _calenarService.Events.Insert(myEvent, "primary");
        recurringEvent.SendNotifications = true;
        recurringEvent.ConferenceDataVersion = 1;
        
        Event eventData = recurringEvent.Execute();

0
投票

这是 Apps 脚本中的代码示例,但所需的请求正文是相同的:

function createBooking() {
  const calendarId = ID_CALENDAR;
  const request = {
    summary: "Meet title",
    description: "",
    start: {
      timeZone: 'America/Sao_Paulo',
      dateTime: '2023-08-25T09:00:00-03:00'
    },
    end: {
      timeZone: 'America/Sao_Paulo',
      dateTime: '2023-08-25T10:30:00-03:00'
    },
    conferenceData: {
      createRequest: {
        requestId: Utilities.getUuid(),
        conferenceSolutionKey: {
          type: "hangoutsMeet"
        },
      }
    },
  }
  const event = CalendarApi.Events.insert(request, calendarId, {conferenceDataVersion: 1});
  console.log(event);
}
© www.soinside.com 2019 - 2024. All rights reserved.