简体   繁体   中英

Exchange - Interval is missing in Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern

When you create an appointment through a client like outlook, you are able to set an interval for a yearly recurring appointment. But this member is not included in the classes we have to work with through the web services:

http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.recurrence.yearlypattern_members(v=exchg.80).aspx

This is, because YearlyPattern is no subclass of IntervalPattern as every other patterntype is:

http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.recurrence(v=exchg.80).aspx

Does anybody know, what's the cause of this? Is there a chance to get the interval property? Is there possibly a workaroundwe can use?

This is an obvious gap in the API that for some reason in MS's infinite wisdom they decided to exclude that key value.

Right now i don't have a complete code sample but i do have all the peaces of the puzzle. You will need to extract the value from another property.

First you will need to get the PidLidAppointmentRecur MAPI property

Here is the Extended Property Definition, add this to the property set you request with the appointment:

static ExtendedPropertyDefinition AppointmentRecur = new ExtendedPropertyDefinition(
    DefaultExtendedPropertySet.Appointment,
    0x8216,
    MapiPropertyType.Binary
);

Extract the byte array: appointment.TryGetProperty(AppointmentRecur, out byte[] appointment_recurence);

 Extract the byte array: appointment.TryGetProperty(AppointmentRecur, out byte[] appointment_recurence); 

Then parse it, see this guide to get you started:

Your looking for 3 values:

  • RecurFrequency
  • PatternType
  • Period

The RecurFrequency & PatternType are enums, i don't have a source for. The Period is the interval number.

I expect to find something like:

  • RecurFrequency = 0x200D (Yearly)
  • PatternType = 0x0002 (Month)

So once you have the values you will need to calculate the yearly interval based on the PatternType and the Period.

I'll be getting the RecurFrequency for validation purposes.

Well i hope its obvious by now but you could replace the EWS Recurrence property with this if you feel like parseing the whole struct.

Another good resource:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM