gpt4 book ai didi

c# - 取消删除 Google 日历事件

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:39 25 4
gpt4 key购买 nike

我有一个 c# 应用程序可以在谷歌日历中创建事件。为了自己的目的,它控制事件的 UID,有时想要删除和重新创建事件。

当尝试重新创建与已删除事件具有相同 UID 的事件时,它会收到“远程服务器返回错误:(409) 冲突。”

我可以通过将“?showdeleted=true&showhidden=true”附加到请求 URL 来查看已删除的事件。

但是我在 API 中看不到任何允许我在检索已删除事件后取消删除的内容。

有什么建议吗?

更新:

尝试 Jay 的建议我有类似的东西

var service = new CalendarService();
service.setUserCredentials("XXX", "XXX");
var query = new CalendarQuery { Uri = new Uri("http://www.google.com/calendar/feeds/default/owncalendars/full") };
var cal = service.Query(query).Entries
.Select (e => new { Title = e.Title.Text, Uri = e.SelfUri,
Id = e.SelfUri.Content.Split('/').Last () } )
.Single (e => e.Title == calendarName);
var eventQuery = new EventQuery(string.Format(@"http://www.google.com/calendar/feeds/{0}/private/full?showdeleted=true&showhidden=true", cal.Id));
var evs = service.Query(eventQuery).Entries.Cast<EventEntry>().ToList();
evs[0].Status = EventEntry.EventStatus.CONFIRMED;
service.Update(ev[0]);

它给我“远程服务器返回错误:(404) 未找到。”

最佳答案

您可以取消删除an event通过将其 status 属性从 cancelled 更改为 confirmed

您可以使用 events.patch() 亲自尝试一下在 Google API Explorer 中运行.您需要开启 OAuth 授权,然后输入日历和事件 ID。

关于c# - 取消删除 Google 日历事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18188681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com