Add conference to event Google Calendar API
Asked Answered
G

2

1

I can create an event but I can't create an event with a conference.

I tried all these types: "eventHangout" "eventNamedHangout" "hangoutsMeet" but still getting Invalid conference type value

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

Here's the code that creates and executes an event:

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();

Here's the code of CreateConferenceData() method:

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

 return conferenceData;
Genip answered 19/2, 2021 at 12:57 Comment(7)
I suspect the problem is you're specifying CreateRequest and ConferenceSolution. The docs say "Either conferenceSolution and at least one entryPoint, or createRequest is required." I'd try just specifying ConferenceSolution+EntryPoints, or specify just CreateRequest.Rigsdaler
@JonSkeet Thank you for your answer. I've just tried using only CreateRequest and got just BadRequest without a message, I think I am on the right wayGenip
Well I'd try with just ConferenceSolution+EntryPoint then. The docs really do seem to be discouraging you from specifying all three.Rigsdaler
@JonSkeet both CreateRequest and ConferenceSolution+EntryPoints didn't work. Back again to the same exception :( But thanks anywayGenip
Okay. You might want to try using the API Explorer to experiment. I'd be very surprised if this were a client library issue, but I suppose it's just possible. You might want to file an issue via the bug tracker linked in developers.google.com/calendar/support - if nothing else, clearer error messages would obviously help.Rigsdaler
Might be helpful: #64540347Commove
@JonSkeet I'm hitting the same issue. Code like OP's CreateConferenceData() used to work, but no longer does. API Explorer works just fine, so I suspect it's a problem with the client libraries. Issue logged here: github.com/googleapis/google-api-dotnet-client/issues/1894 but I can also log at the bug tracker if preferredAlsatia
A
1

this is my service and worked perfect conference event

            _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();
Arrogate answered 6/4, 2021 at 13:23 Comment(4)
Using a ConferenceData like yours definitely still gives me "Invalid conference data"Alsatia
Recommend changing the RequestId to this: RequestId = Guid.NewGuid().ToString();Joettajoette
Did not work for meDesmonddesmoulins
what error you'r facing . can you share your errorArrogate
L
0

Here it's a code sample within Apps Script, but the required request body it is the same:

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);
}
Leveridge answered 25/8, 2023 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.