我有一个php代码,生成和发送outlook事件。但是它把用户状态设为Busy,我们不希望那样。我知道我可以向某人发送事件,并将该事件的状态设置为空闲时间。但我不知道,如何在我的代码中做到这一点。所以我的问题是,我需要更改哪个参数,以将事件状态设置为空闲时间?
代码:
$ical = 'BEGIN:VCALENDAR' . "rn" .
'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "rn" .
'VERSION:2.0' . "rn" .
'METHOD:REQUEST' . "rn" .
'BEGIN:VTIMEZONE' . "rn" .
'TZID:Central Europe Standard Time' . "rn" .
'BEGIN:STANDARD' . "rn" .
'DTSTART:16011028T030000' . "rn" .
'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10' . "rn" .
'TZOFFSETFROM:+0200' . "rn" .
'TZOFFSETTO:+0100' . "rn" .
'END:STANDARD' . "rn" .
'BEGIN:DAYLIGHT' . "rn" .
'DTSTART:16010325T020000' . "rn" .
'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3' . "rn" .
'TZOFFSETFROM:+0100' . "rn" .
'TZOFFSETTO:+0200' . "rn" .
'END:DAYLIGHT' . "rn" .
'END:VTIMEZONE ' . "rn" .
'BEGIN:VEVENT' . "rn" .
'ORGANIZER;CN="'.$name.'":MAILTO:'.$name. "rn" .
'ATTENDEE;CN="'.$name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$name.','.$address.','.$address2.' ,'.$address3. "rn" .
'LAST-MODIFIED:' . date("YmdTGis") . "rn" .
'UID:'.date("YmdTGis", strtotime($startTime)).rand()."@".$domain."rn" .
'DTSTAMP:'.date("YmdTGis"). "rn" .
'DTSTART;TZID="Central Europe Standard Time":'.date("YmdTHis", strtotime($startTime)). "rn" .
'DTEND;TZID="Central Europe Standard Time":'.date("YmdTHis", strtotime($endTime)). "rn" .
'TRANSP:OPAQUE'. "rn" .
'SEQUENCE:1'. "rn" .
'SUMMARY:' . $subject . "rn" .
'CLASS:PUBLIC'. "rn" .
'PRIORITY:5'. "rn" .
'BEGIN:VALARM' . "rn" .
'TRIGGER:-PT15M' . "rn" .
'ACTION:DISPLAY' . "rn" .
'DESCRIPTION:Reminder' . "rn" .
'END:VALARM' . "rn" .
'END:VEVENT'. "rn" .
'END:VCALENDAR'. "rn";
$mail->Subject = "Invitation: Outlook Calendar Event";
$mail->AddStringAttachment($ical, "event.ics", "7bit", "text/calendar; charset=utf-8; method=REQUEST");
$mail->Body = "Test Outlook Calendar event mail";
$mail->Ical = $ical;
$mail->CharSet = 'UTF-8';
只需在ical中添加这一行,并注明正确的日期和时间:
FREEBUSY;FBTYPE=FREE:[date start format Ymd]T[time start format Gis]Z/[date end format Ymd]T[time end format Gis]Z
。:FREEBUSY;FBTYPE=BUSY:19980415T133000Z/19980415T170000Z
或者,如果是Outlook:
X-MICROSOFT-CDO-BUSYSTATUS:FREE
来源:
- https://icalendar.org/iCalendar-RFC-5545/3-2-9-free-busy-time-type.html
- https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736