VSTO Outlook Retrieving TimeZoneStruct from Appointment

1

Short Version

I am attempting to access the TimeZoneStruct using VSTO from an Outlook Appointment. The following error is thrown when attempting to access it.

System.Runtime.InteropServices.COMException (0x80040102): Object does not support property "http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/82330102".

Interestingly, I am able to get a similar property, TimeZoneDescription, using the same method with no exceptions: http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8234001F

My code is below; the first call to GetProperty succeeds, but the second does not.

//OK returns TimeZone Description string
dynamic tz1 = pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8234001F"); 

//NOK throws a COMException
dynamic tzStruct = pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/82330102");

Long Version

I am developing a plugin that reads the Outlook calendar.

Currently the difficulty is with recurring appointments that were created with different timezones that have different Daylight Savings Time settings.

In order to find all appointments of a recurring meeting series, I need timezone information.

The first approach I used was to obtain the timezone information by extracting the timezone name. This works in most cases but is not ideal.

Outlook.PropertyAccessor pa = appointment.PropertyAccessor;
dynamic tz1 = pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8234001F");

This returns a string similar to (UTC+01:00) Amsterdam, Berlijn, Bern, Rome, Stockholm, Wenen.

This works correctly, but appointments that were sent from PC's with different languages, or in the case of "old" meetings with "obsolete" timezones that were deleted in a Windows Update, this does not work so well.

I will get meetings from computers from other languages, for instance this timezone is in French and my computer will not find it. (UTC+03:00) Moscou, Saint-Pétersbourg, Volgograd

There are also updates; this timezone below no longer exists. Volograd was put in its own timezone at UTC+04:00 in 2016. See link from Microsoft.

  • Old: (UTC+03:00) Moscow, St. Petersburg, Volgograd
  • New: (UTC+03:00) Moscow, St. Petersburg

Obviously, matching the timezone name is never going to work.

I am focusing on getting the full information using the TimeZoneStruct instead; which should allow me to create a custom TimeZoneInfo Object; and then later I will be able to convert it into Local Time.

My problem is that when attempting to access this struct, I am getting the following error: System.Runtime.InteropServices.COMException (0x80040102): Object does not support property "http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/82330102".

I have looked at OutlookSpy and can see that the property is indeed accessible.

I am using .NET Framework 4.6; Outlook 2016; Visual Studio 2015; Windows 8.1.

Any suggestions?

UPDATE

I'm trying to access this property using VBscript on Outlook Spy and getting a similar error. The properties that are not PT_BINARY seem to work, for some reason. Any ideas?

here's how to repeat the experiment

Using OutlookSpy, select a recurring appointment. Make sure you are selecting the master and open the "Current Item" to run a script on the current AppointmentItem.

Enter the following code. See screenshot for reference.

set msg = AppointmentItem
set pa = msg.PropertyAccessor

debug.print pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/8234001F")
debug.print pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/82310003")
debug.print pa.GetProperty("http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/82330102")

Trying to obtain property with OutlookSpy

c#
outlook
timezone
vsto
outlook-addin
asked on Stack Overflow Mar 13, 2019 by idocgreen • edited Mar 13, 2019 by idocgreen

1 Answer

1

Outlook likes to play the Big Brother to prevent you from modifying, or sometimes even accessing, some properties that it considers special.

Using Extended MAPI (C++ or Delphi) or Redemption (any language, I am its author) instead of OOM is the only workaround.

answered on Stack Overflow Mar 13, 2019 by Dmitry Streblechenko • edited Mar 13, 2019 by Dmitry Streblechenko

User contributions licensed under CC BY-SA 3.0