
注意:不一定是 Google 日曆。我目前正在使用 Google 日曆,但我將能夠切換到任何允許我執行此功能的服務。
有什麼方法可以將一個 Google 日曆複製到另一個 Google 日曆並提前 2 天調整所有內容嗎?
例如
一份 Google 日曆可能在星期三、星期四和星期五有 3 個全天活動。我希望另一個 Google 日曆是前一個日曆的精確克隆,除了 3 個全天活動分別為星期一、星期二和星期三。
另外,這只是一個獎勵,但如果可能的話,每當我對第一個日曆進行更改時,該更改都會應用到第二個日曆,除非再次提前 2 天。不過,這是一個額外的好處,所以如果我必須手動按下按鈕或為我所做的每個更改運行腳本,這對我來說沒問題。
我永遠不會更改第二個日曆,因此單向同步就可以了。
編輯:也許我可以將 Google 日曆匯出為某種開放文件格式(例如開放文件格式),並在該文件上運行腳本以提前 2 天移動日期?
答案1
如果您知道如何編程,您可以使用 php 輕鬆完成此操作。 Google Calendar API 允許完全存取日曆。編寫腳本後,您只需單擊一個按鈕即可啟動 php 網頁,它就可以為整個日曆執行此操作。
這只是基本綱要,而不是完整的計劃
$room="named of master calendar"
$room2="destination calendar"
$calList = $cal->calendarList->listCalendarList();
foreach ( $calList["items"] as $stuff) {
if (strcasecmp($stuff["summary"],$room1)==0) {
$calendar1=$stuff["id"];
$found=1;
break;}
}
foreach ( $calList["items"] as $stuff) {
if (strcasecmp($stuff["summary"],$room2)==0) {
$calendar2=$stuff["id"];
$found=1;
break;}
}
$existEvents = $cal->events->listEvents($calendar1["id"]);
foreach ($existEvents["items"] as $item)
{
**TODO: this part incomplete!**
The individual parts would have to be copied from $items to a new Google_Event
add 2 for the start and end dates.
$createdEvent = $cal->events->insert($calendar2["id"], $event);
}