【问题标题】:Remove Google Meet link from Goocle Calendar Event using Google Calendar .Net SDK使用 Google Calendar .Net SDK 从 Google Calendar Event 中删除 Google Meet 链接
【发布时间】:2020-10-08 06:51:20
【问题描述】:

我在我的项目中使用 Google.Apis.Calendar.v3 .NET Nuget 包来创建谷歌日历事件。但它会自动将 Google Meet 链接添加到我不想添加的活动中。

当我创建活动时,通知邮件会发送给包含此字符串的与会者:

加入信息 加入 Google Meet meet.google.com/******

如何从我的活动中删除 Google Meet。我尝试将此 ConferenceData 属性添加到 Event 对象并将其值设置为 null 但 Google Meet 在 Google Calendar Event 中仍然可见。

     Event calendarEvent = new Event
            {
                ... ,
                ConferenceData = null
            };

【问题讨论】:

    标签: .net google-api google-calendar-api


    【解决方案1】:

    如果您使用的是 G Suite 帐户,则可以作为this question 的答案:

    要禁用自动将 Meet 会议添加到从 API 创建的任何事件中:

    1. 作为管理员,请转至admin.google.com
    2. 转到应用程序 > G Suite > 日历设置 > 共享设置
    3. Video Calls 设置为OFF

    另外,我建议您查看Add video and phone conferences to events 的指南。

    里面有一些关于如何修改事件的解释:

    conferenceData字段可用于读取、复制和清除现有会议详情;它也可以用于请求生成新的会议。要允许创建和修改会议详细信息,请将 conferenceDataVersion 请求参数设置为 1。

    【讨论】:

    • 有没有办法以编程方式进行此操作,我的意思是我不想使用我的 Google 套件帐户为所有活动禁用 Google Meets。我只想为从我的代码以编程方式创建的事件禁用 google meet。
    • 您可以创建事件然后删除它(在这种情况下删除可能意味着将其留空)
    【解决方案2】:

    使用 PHP 我是这样实现的:

    $event_data = array(
            'summary' => $event->getSubject(),
            'location' => $event->getLocation()->getDisplayName(),
            'description' => $html,
            'start' => array(
                'dateTime' => $event->getStart()->getDateTime(),
                'timeZone' => $event->getStart()->getTimeZone(),
            ),
            'end' => array(
                'dateTime' => $event->getEnd()->getDateTime(),
                'timeZone' => $event->getEnd()->getTimeZone(),
            ),
            'reminders' => [
                'useDefault' => true,
            ],
            'attendees' => array(
                array('email' => 'lpage@example.com'),
                array('email' => 'sbrin@example.com'),
            ),
            'conferenceData' => null,
        );
    
    $google_event_insert = $service->events->insert($calendarId, $google_event, ['conferenceDataVersion' => 1]);
    

    请注意,从上面的代码中,我们将 "conferenceData" 发送为 null + 将查询参数conferenceDataVersion=1 添加到插入请求中。

    这对我来说完全没问题。您可以在 .net 代码中以类似的方式使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多