-1

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

I get:

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

jazb
  • 5,498
  • 6
  • 37
  • 44
  • Can you share the full code in one piece? It seems like you are creating a duplicate ConferenceSolutionKey. Does the error gives you an exact line where the error is? – Kessy Feb 05 '21 at 11:32
  • I'm trying this: [link](https://github.com/jesustorrst/GoogleMeetTest/blob/master/GoogleMeetTest/GoogleMeetTest/Program.cs) , the error is in the line 116 ( Event createEvent = request.Execute(); ) Do you have any example to create an Event with videoconference in GoogleMeet? – Jesús Torres Torres Feb 05 '21 at 14:43
  • Does this answer your question? [Strange error message being returned when creating calendar event](https://stackoverflow.com/questions/55655409/strange-error-message-being-returned-when-creating-calendar-event) – Franz Gleichmann Feb 05 '21 at 16:04
  • Thanks, but I don't get it what means in the value **eventNamedHangout** because I'm using a GCP service account credentials to create the event – Jesús Torres Torres Feb 05 '21 at 16:29
  • @Kessy I'm trying this [Link](https://stackoverflow.com/questions/66066279/how-to-create-event-with-videoconference-in-google-meet-in-c-sharp-using-google/66098344#66098344) the same thing you told me earlier as it duplicated the ConferenceSolutionKey but it keeps sending me the error when y Execute the request – Jesús Torres Torres Feb 08 '21 at 14:08
  • Have you tried changing the conference type and creating the request following the structure reference from [Resource representations](https://developers.google.com/calendar/v3/reference/events#resource-representations) – Kessy Feb 12 '21 at 13:14

1 Answers1

0

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.

Try this:

        calendarEvent.ConferenceData = new ConferenceData
        {
            CreateRequest = new CreateConferenceRequest
            {
                RequestId = "1234abcdef",
                ConferenceSolutionKey = new ConferenceSolutionKey
                {
                    Type = "hangoutsMeet"
                }
            },
        };
ganyu
  • 1
  • But what happend with `EntryPoints = new List { new EntryPoint { EntryPointType="video", Uri="", Label="" } }` It's neccesary? I tried but I got the same error – Jesús Torres Torres Feb 05 '21 at 18:57