c# - 如何在 C# 中的 Google Meet 中通过视频会议在 Google Calendar API 中创建事件?
问题描述
我正在尝试这段代码使用 C# 创建对象事件,三个月前它起作用了,我创建了事件,但现在不起作用,我意识到程序集有一个新参数“事件类型”,但我不知道它是否影响我的对象事件
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"
}
},
};
推荐阅读
- javascript - 我可以从对象创建 if 语句吗?
- javascript - 创建对象的事件监听器
- python-3.x - 在异步函数中使用全局变量不起作用
- django - 如何将 django 1.8 用户迁移到 firebase
- javascript - 类型错误:_store_js__WEBPACK_IMPORTED_MODULE_12__.default.subscribe 不是函数
- android-studio - Flutter 控制台日志“发送请求失败:{"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}}"
- reactjs - Reactjs 传递样式有效但不是动态的?
- regex - 捕获任意组项目
- python - 从 sympy 生成优化的倍频程代码
- javascript - Protractor 仅执行列表中的第一个测试套件