阅读背景:

使用TMS Cloud组件更新现有的Google日历条目

来源:互联网 

I use the following code to add a new entry to my Google calendar using TMS Cloud component I have the new entries in a table in a database and they are added OK But I would like to be able to update an entry also, but that I cant find any help about. The demo that is supplied with the controls has the option, but I don't want to load all entries from the calendar and select the one to edit there. I want to save some sort of entryID that it is given and use that to update. DevExpress has an option that lets you sync a table to and from Outlook calendar (works very nice) so I think it should be possible to do with TMS

我使用以下代码使用TMS Cloud组件向我的Google日历添加新条目我在数据库的表中添加了新条目并添加了它们但是我希望能够更新条目,但是我无法找到任何帮助。随控件提供的演示有选项,但我不想从日历中加载所有条目并选择要在那里编辑的条目。我想保存它给出的某种entryID并使用它来更新。 DevExpress有一个选项,可以让你与Outlook日历同步一个表(工作非常好)所以我认为应该可以使用TMS

The question is: how do I get an ID of a calendar entry when creating it so I can store it with the record in table and use it afterwards for updating?

问题是:如何在创建日历条目时获取日历条目的ID,以便我可以将其与表中的记录一起存储,然后使用它进行更新?

var
  ci: TGCalendarItem;
begin
      AdvGCalendar.App.Key    := Settings.Google.Key;
      AdvGCalendar.App.Secret := Settings.Google.Secret;
      AdvGCalendar.Logging := true;

      if not AdvGCalendar.TestTokens then
        AdvGCalendar.RefreshAccess;

      if not AdvGCalendar.TestTokens then
        AdvGCalendar.DoAuth
      else
        Connected := True;

      ci := AdvGCalendar.Items.Add;

      AdvGCalendar.GetCalendars();
      ci.CalendarID := Settings.Google.Calendar;
      if ci.CalendarID <> '' then
        begin
          ci.Location     := CiLocation;
          ci.Description  := CiDescription;
          ci.Summary      := CiSummary;
          ci.StartTime    := EncodeDateTime(YearOf(StartDate), MonthOf(StartDate), DayOf(StartDate), HourOf(StartTime), MinuteOf(StartTime), 0, 0);
          ci.EndTime      := EncodeDateTime(YearOf(StopDate), MonthOf(StopDate), DayOf(StopDate), HourOf(StopTime), MinuteOf(StopTime), 0, 0);
          ci.IsAllDay     := False;
          ci.Visibility   := viPrivate;
          AdvGCalendar.Add(ci);
        end;
end;

1 个解决方案

#1


0  

The problem was related to the fact that there was an error in the version I was using of the component so that the ID was not returned OK.

问题与我使用组件的版本中存在错误这一事实有关,因此ID未返回OK。

Upgrading to a newer version fixed this so now it is working.

升级到更新的版本修复了这个现在它正在工作。


分享到: