如何在创建Google事件后收到的电子邮件通知中删除GoogleMeet?

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

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS90VlFKWS5wbmcifQ==” alt =“在此处输入图像描述”>

我正在努力使用google api文档...我是一名非常初级的开发人员,希望有人能够为我提供帮助。我读了很多书,测试了很多书,但是我不知道该在哪里放置conference_data_version:0,这可能会从我的通知中删除所有的GoogleMeet。我正在尝试在自然人之间创建事件,因此电子邮件中没有GoogleMeet的可能性。

这是我测试过的(事件已添加到日历中,并且电子邮件已经发送,只需删除该会议部分...):

     event = Google::Apis::CalendarV3::Event.new(
        summary: "CalendarMatcher -#{match_info.title}",
        location: match_info.location,
        description: "Descritption: #{match_info.description}",


         start: Google::Apis::CalendarV3::EventDateTime.new(
          date_time: start_time,
          time_zone: 'Europe/Brussels'
          ),
        end: Google::Apis::CalendarV3::EventDateTime.new(
          date_time: end_time,
          time_zone: 'Europe/Brussels'
          ),

      attendees:  attendeesList,

      conference_data: {
      },

      reminders: Google::Apis::CalendarV3::Event::Reminders.new(
        use_default: false,
        overrides: [
          Google::Apis::CalendarV3::EventReminder.new(
            reminder_method: 'email',
            minutes: minutes
            ),
          Google::Apis::CalendarV3::EventReminder.new(
            reminder_method: 'popup',
            minutes: 30
            )
        ]
        )
      )
      result = service.insert_event('primary', event, conference_data_version: 0)
ruby google-calendar-api
3个回答
0
投票

error message when I set conference_data_version

所以我换了:结果= service.insert_event('主要',事件,会议数据版本:1)

但是出现错误:“未知关键字:conference_data_version”。 :(


0
投票

答案:

您需要将conference_data_version设置为1

代码更改:

result = service.insert_event('primary', event, conference_data_version: 0)

应更改为:

result = service.insert_event('primary', event, conference_data_version: 1)

此外,您无需在事件资源中指定空的conference_data: {}对象。

希望对您有帮助!


0
投票
class SendInvitation
  def self.new(match_info,current_user)

    begin

      authorization = GoogleRefresh.auth_client(current_user)
      service = Google::Apis::CalendarV3::CalendarService.new
      service.authorization = authorization

      match_date = match_info.match_date.strftime("%F")
      min_time = match_info.min_time.strftime("%T%:z")
      max_time = match_info.max_time.strftime("%T%:z")
      start_time = "#{match_date}T#{min_time}"
      end_time = "#{match_date}T#{max_time}"

      minutes = ((start_time.to_time-Time.now) / 60).to_i

      attendeesList = Match.find(id=match_info.id).users.map{|user| Google::Apis::CalendarV3::EventAttendee.new(email: "#{user.email}")}
      attendeesList<<Google::Apis::CalendarV3::EventAttendee.new(email: "#{User.find(id=match_info.owner_id).email}")



      event = Google::Apis::CalendarV3::Event.new(
          summary: "CalendarMatcher -#{match_info.title}",
          location: match_info.location,
          description: "Descritption: #{match_info.description}",


           start: Google::Apis::CalendarV3::EventDateTime.new(
            date_time: start_time,
            time_zone: 'Europe/Brussels'
            ),
          end: Google::Apis::CalendarV3::EventDateTime.new(
            date_time: end_time,
            time_zone: 'Europe/Brussels'
            ),

        attendees:  attendeesList,

        reminders: Google::Apis::CalendarV3::Event::Reminders.new(
          use_default: false,
          overrides: [
            Google::Apis::CalendarV3::EventReminder.new(
              reminder_method: 'email',
              minutes: minutes
              ),
            Google::Apis::CalendarV3::EventReminder.new(
              reminder_method: 'popup',
              minutes: 30
              )
          ]
          )
        )


        result = service.insert_event('primary', event)



        puts "Event created: #{updated_result.html_link}"

      rescue ::Google::Apis::AuthorizationError => e
      authorization.grant_type = 'refresh_token'
      authorization.access_token = current_user.token
      authorization.refresh_token = current_user.refresh_token
      response = authorization.refresh!
      current_user.token = response['access_token']
      current_user.save

      retry
    end

  end
end

这是将电子邮件发送给与会者的所有方法。运行正常:它发送电子邮件。

但是电子邮件中包含我要删除的GoogleMeet链接。因此,我阅读了互联网上的所有文档。据我了解,GoogleMeet会响应一些“会议数据”设置...

但是当我开始添加conference_data_version时:1。result = service.insert_event('primary', event, conference_data_version: 1);我收到以下错误消息:“未知关键字:conference_data_version”

我被卡住了(很清楚;))。

我仍然没有完全解决的一个问题是:创建活动时是否必须直接包括会议设置?还是我必须创建一个事件,然后使用会议设置更新该事件(修补事件)?

当您刚开始编写代码时,Google文档非常困难。我希望这可以帮助您更好地了解我的需求。因此,当您问您确定要给正确的服务打电话吗? ...也许不是...我肯定错过了一些东西!

© www.soinside.com 2019 - 2024. All rights reserved.