none
HRESULT 0x8004010F When Finding an Outlook Appointment UserProperty - Exchange Server client RRS feed

  • Question

  • I have a C# VSTO  Outlook Add-In that works perfectly with stand-alone Outlook.

    It creates Outlook Appointments with some User Properties

    However when added to Outlook which is a Microsoft Exchange client I get HRESULT 0x8004010F at this line of code retrieving a User Property from an already created Appointment

    if (outlookAppointment.UserProperties.Find(CommonFeatures.USER_PROPERTY_IS_FIREBELLY_APPOINTMENT, true)  == null

    User Properties are added when an Appointment is created  like this:

      private static void AddUserPropertyBoolean(
                AppointmentItem outlookAppointment,
                String name)
            {
                UserProperty obj = outlookAppointment.UserProperties.Find(name);
    
                if (obj == null)
                { outlookAppointment.UserProperties.Add(name, OlUserPropertyType.olYesNo, false,OlFormatYesNo.olFormatYesNoYesNo); }
            }

    Sunday, March 18, 2018 8:07 PM

All replies

  • Is that an instance of a recurring appointment? Or the master one?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, March 19, 2018 12:22 AM
  • Hi Dmitry

    It is a non-recurring Appointment

    It has been suggested to me that the Appointment may not yet be loaded - in which case, as I understand it:

    "Data for the item is not yet available, other than the values for the Class and MessageClass properties of the Outlook item, so an error occurs when calling any property other than Class or MessageClass for the Outlook item returned in Item. " https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.applicationevents_11_event.itemload.aspx

    IF this could be the case - is there a "workaround" ?

    Monday, March 19, 2018 4:54 AM
  • BTW

    In my Add-In Appointments may have Attachments - documents stored in a folder on the network

    Monday, March 19, 2018 5:11 AM
  • I doubt it - Exchange items are synchronized in full.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, March 19, 2018 3:43 PM
  • When exactly is your code invoked?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, March 19, 2018 3:43 PM
  • Hello Andrew,

    If you handle the NewInspector event of the Inspectors class, you need to wait for the first Activate event of the Inspector class. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, March 19, 2018 4:49 PM
  • Thanks guys

    I have found there are 2 different scenarios where this occurs

    It looks to me like in both cases the Appointment COM item is not yet loaded so a COM error occurs
    Implying that an MES Appointment is loaded "more slowly".

    1. Code in the BeforePaste event
    *  I have eliminate d this by reconstituting the clipboard contents into an Appointment  - guaranteeing that the COM item IS fully loaded

    2.Code in the  SelectionChange event - but only when my customer  FormRegion is opening
    * Un fact the SelectionCHange event is fired multiple times - with the error occurring when code handles all but he last one. The Form Region does open correctly

    The issue only occurs on our client's PC which are MSE clients
    Question1 1: Is MES inherently a lot slower than stand alone Outlook in loading items?
    Question 2: Most of our Appointments have attachments which come from a folder on the servre running MES. Is "loading" these Attachments causing the slowness?

    Thursday, March 22, 2018 6:42 AM
  • 1. No. Especially if you are using a cached (OST) store.

    2. No what you are experiencing is not slowness, but some kind of a timing issue. Are you sure your code is looking at the right item? Please show your code that retrieves the item and provide some context when it runs.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, March 23, 2018 4:21 PM
  • I don't have code to retrieve Attachments

    Attachments are added to an Appointment 

    * either by a user

    * or when Form Region opens

    appointment.Attachments.Add(documentPath, OlAttachmentType.olByValue, 10);
    If no appointments are attached by code - the Appointment is still "slow" to open

    Saturday, March 24, 2018 4:46 PM