When using the DDay ical library, How do you indicate busy versus free versus out office?

StackOverflow https://stackoverflow.com/questions/19758543

  •  03-07-2022
  •  | 
  •  

Question

I am using the DDal ical library which works great but i just realized that i wanted to see how to indicate an event as out of office versus busy (so it shows up different when loaded in microsoft outlook

I see the property listed on this microsoft site called:

  • X-MICROSOFT-CDO-BUSYSTATUS
  • PidLidBusyStatus

Is this possible to set this from within DDay ical library as i don't see anything in the documentation?

Was it helpful?

Solution

If you have Free/Busy Component on your mind described in RFC 2445, then it is not implemented yet based on the DDay.iCal Compliance with RFC 2445 list.

OTHER TIPS

(Don't use dday.ical; use ical.net. It contains many performance enhancements and bugfixes.)

Anything prefixed with X- means it's vendor-specific. There is no standard way to say "out of office" vs "busy". I believe Outlook also has a notion of "tentative" that also goes into that field.

The icalendar spec supports four basic statuses: "FREE", "BUSY", "BUSY-UNAVAILABLE", "BUSY-TENTATIVE". These are all valid options for the VFREEBUSY component. The spec intends for the VFREEBUSY with its subheading FREEBUSY components to essentially communicate free-busy information for people trying to plan a meeting. Outlook has its scheduling assistant feature; it may will be using VFREEBUSY information to show its timelines.

So that's not really what you're looking for.

The spec does have a notion of categories, and one of the examples is "NOT IN OFFICE":

Some possible English values for "CATEGORIES" property include: "ANNIVERSARY", "APPOINTMENT", "BUSINESS", "EDUCATION", "HOLIDAY", "MEETING", "MISCELLANEOUS", "NON-WORKING HOURS", "NOT IN OFFICE", "PERSONAL", "PHONE CALL", "SICK DAY", "SPECIAL OCCASION", "TRAVEL", "VACATION". Categories can be specified in any registered language.

Neither of these options is great, and is, IMO, yet another place the spec falls short. You almost want a BUSY-OUT-OF-OFFICE status that can be specified in a VFREEBUSY manifest, but the spec doesn't have it, and neither does ical.net (or dday.ical before it).

To that end, you're better off adding the X-MICROSOFT-CDO-BUSYSTATUS property to the event manually, if Outlook is the thing consuming the serialized output:

var now = DateTime.Now;
var later = now.AddHours(1);

var e = new Event
{
    DtStart = new CalDateTime(now),
    DtEnd = new CalDateTime(later),
};
e.AddProperty("X-MICROSOFT-CDO-BUSYSTATUS", "OOF"); // I think "OOF" is right per the MS documentation

var calendar = new Calendar();
calendar.Events.Add(e);

var serializer = new CalendarSerializer(new SerializationContext());
var icalString = serializer.SerializeToString(calendar);
Console.WriteLine(icalString);

That'll generate this:

BEGIN:VCALENDAR
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 2.1//EN
VERSION:2.0
BEGIN:VEVENT
DTEND:20160827T162931
DTSTAMP:20160827T192931Z
DTSTART:20160827T152931
SEQUENCE:0
UID:fea526df-7f40-4585-a9de-8d422e43eebe
X-MICROSOFT-CDO-BUSYSTATUS:OOF
END:VEVENT
END:VCALENDAR
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top