php-将事件发送到日历为闲暇时间

发布于 2025-02-04 02:02:44 字数 2169 浏览 3 评论 0 原文

我有一个PHP代码,该代码生成并发送Outlook事件。但是它将用户状态设置为忙碌,我们不想要那个。我知道我可以将事件发送给某人,并将状态设置为该事件的空闲时间。但是我不知道,如何在我的代码中做到这一点。所以我的问题是,我需要更改哪个参数,以将事件状态设置为空闲时间?

代码 :

$ical = 'BEGIN:VCALENDAR' . "\r\n" .
    'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
    'VERSION:2.0' . "\r\n" .
    'METHOD:REQUEST' . "\r\n" .
    'BEGIN:VTIMEZONE' . "\r\n" .
    'TZID:Central Europe Standard Time' . "\r\n" .
    'BEGIN:STANDARD' . "\r\n" .
    'DTSTART:16011028T030000' . "\r\n" .
    'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10' . "\r\n" .
    'TZOFFSETFROM:+0200' . "\r\n" .
    'TZOFFSETTO:+0100' . "\r\n" .
    'END:STANDARD' . "\r\n" .
    'BEGIN:DAYLIGHT' . "\r\n" .
    'DTSTART:16010325T020000' . "\r\n" .
    'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3' . "\r\n" .
    'TZOFFSETFROM:+0100' . "\r\n" .
    'TZOFFSETTO:+0200' . "\r\n" .
    'END:DAYLIGHT' . "\r\n" .
    'END:VTIMEZONE ' . "\r\n" .
    'BEGIN:VEVENT' . "\r\n" .


    'ORGANIZER;CN="'.$name.'":MAILTO:'.$name. "\r\n" .
    'ATTENDEE;CN="'.$name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$name.','.$address.','.$address2.' ,'.$address3. "\r\n" .
    'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
    'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" .
    'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
    'DTSTART;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($startTime)). "\r\n" .
    'DTEND;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" .
    'TRANSP:OPAQUE'. "\r\n" .
    'SEQUENCE:1'. "\r\n" .
    'SUMMARY:' . $subject . "\r\n" .
    'CLASS:PUBLIC'. "\r\n" .
    'PRIORITY:5'. "\r\n" .
    'BEGIN:VALARM' . "\r\n" .
    'TRIGGER:-PT15M' . "\r\n" .
    'ACTION:DISPLAY' . "\r\n" .
    'DESCRIPTION:Reminder' . "\r\n" .
    'END:VALARM' . "\r\n" .
    'END:VEVENT'. "\r\n" .
    'END:VCALENDAR'. "\r\n";

    $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';

I have a php code, that generates and sends outlook event. But it sets user status as Busy and we dont want that. I know that I can send event to someone and set status as free time for that event. But I have no idea, how to do it in my code. So my question is, which parameter I need to change, to set event status as free time?

Code :

$ical = 'BEGIN:VCALENDAR' . "\r\n" .
    'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
    'VERSION:2.0' . "\r\n" .
    'METHOD:REQUEST' . "\r\n" .
    'BEGIN:VTIMEZONE' . "\r\n" .
    'TZID:Central Europe Standard Time' . "\r\n" .
    'BEGIN:STANDARD' . "\r\n" .
    'DTSTART:16011028T030000' . "\r\n" .
    'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10' . "\r\n" .
    'TZOFFSETFROM:+0200' . "\r\n" .
    'TZOFFSETTO:+0100' . "\r\n" .
    'END:STANDARD' . "\r\n" .
    'BEGIN:DAYLIGHT' . "\r\n" .
    'DTSTART:16010325T020000' . "\r\n" .
    'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3' . "\r\n" .
    'TZOFFSETFROM:+0100' . "\r\n" .
    'TZOFFSETTO:+0200' . "\r\n" .
    'END:DAYLIGHT' . "\r\n" .
    'END:VTIMEZONE ' . "\r\n" .
    'BEGIN:VEVENT' . "\r\n" .


    'ORGANIZER;CN="'.$name.'":MAILTO:'.$name. "\r\n" .
    'ATTENDEE;CN="'.$name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$name.','.$address.','.$address2.' ,'.$address3. "\r\n" .
    'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
    'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" .
    'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
    'DTSTART;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($startTime)). "\r\n" .
    'DTEND;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" .
    'TRANSP:OPAQUE'. "\r\n" .
    'SEQUENCE:1'. "\r\n" .
    'SUMMARY:' . $subject . "\r\n" .
    'CLASS:PUBLIC'. "\r\n" .
    'PRIORITY:5'. "\r\n" .
    'BEGIN:VALARM' . "\r\n" .
    'TRIGGER:-PT15M' . "\r\n" .
    'ACTION:DISPLAY' . "\r\n" .
    'DESCRIPTION:Reminder' . "\r\n" .
    'END:VALARM' . "\r\n" .
    'END:VEVENT'. "\r\n" .
    'END:VCALENDAR'. "\r\n";

    $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';

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猥琐帝 2025-02-11 02:02:44

只需在适当的日期和时间中添加此行:

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 =忙:19980415T133000Z/19980415T170000Z

or,如果是for Outlook:

X-MICROSOFT-CDO-BUSYSTATUS:FREE

sources:sources:source:

  1. https://icalendar.org/icalendar.org/icalendar-rfc-5545/3-2 -9-free-busy time-type.html
  2. https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736

Just add this line in your ical with the right date and time :

FREEBUSY;FBTYPE=FREE:[date start format Ymd]T[time start format Gis]Z/[date end format Ymd]T[time end format Gis]Z

e.g. : FREEBUSY;FBTYPE=BUSY:19980415T133000Z/19980415T170000Z

Or, if it's for Outlook :

X-MICROSOFT-CDO-BUSYSTATUS:FREE

sources :

  1. https://icalendar.org/iCalendar-RFC-5545/3-2-9-free-busy-time-type.html
  2. https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文