none
property not present Outlook 2016 (Office 365) vs Outlook 2013 RRS feed

  • Question

  • Hi,

    I'm getting the error "the property http //schemas.microsoft.com/mapi/proptag/0x39fe001e is unknown or cannot be found" on the following line of code (where PropertyTagSmtpAddress is the schema url) when running in Outlook 2016 (Office 365), but I don't get the error in Outlook 2013.

    e.g.: string hostEmail = ( _appointmentItem.GetOrganizer( ).PropertyAccessor ).GetProperty( PropertyTagSmtpAddress );

    Somewhere else in the code the same schema url is used to get the address for a Recipient object, which works just fine.

    e.g.: string recipientAddress = theRecipient.PropertyAccessor.GetProperty(PropertyTagSmtpAddress);

    What I understand is that the error says the SmtpAddress property is not present in the first example. What I don't understand is why it is not present. It works on the Recipient object in both Outlook versions. It works on the appointmentitem in Outlook 2013.

    Can anybody explain what is going on here?

    Grtz,

    B

    Sunday, June 5, 2016 10:05 AM

Answers

  • You should not expect any property to be present. It may be present for the EX recipients (PR_ADDRTYPE == "EX"), but it is not guaranteed to be present. 

    Most likely you are dealing with an SMTP recipient anyway. Instead of always reading the PR_SMTP_ADDRESS property, read the PR_ADDRTYPE property. If it is "SMTP", just read the Recipient.Address property (or PR_EMAIL_ADDRESS). Otherwise try to read the PR_SMTP_ADDRESS .

    Take a look at the problematic message with OutlookSpy (click IMessage button, go to the GetRecipientTable tab).


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

    • Marked as answer by Bruno_Latte Tuesday, June 7, 2016 7:45 AM
    Sunday, June 5, 2016 5:34 PM

All replies

  • You should not expect any property to be present. It may be present for the EX recipients (PR_ADDRTYPE == "EX"), but it is not guaranteed to be present. 

    Most likely you are dealing with an SMTP recipient anyway. Instead of always reading the PR_SMTP_ADDRESS property, read the PR_ADDRTYPE property. If it is "SMTP", just read the Recipient.Address property (or PR_EMAIL_ADDRESS). Otherwise try to read the PR_SMTP_ADDRESS .

    Take a look at the problematic message with OutlookSpy (click IMessage button, go to the GetRecipientTable tab).


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

    • Marked as answer by Bruno_Latte Tuesday, June 7, 2016 7:45 AM
    Sunday, June 5, 2016 5:34 PM
  • Hi,

    Thanks for the reply. Could you explain why I shouldn't expect any property to be present?

    I'm a classic C# developer, not an outlook developer, and not familiar with this way of accessing properties. I expected that as I added a reference to the outlook dll's (interop etc.), the schema url would be a reference to something inside these dll's and would always be present. But that's not the case?

    Grtz,

    B

    Monday, June 6, 2016 6:49 AM
  • That is just how MAPI and Outlook work. Think of that property as a nullable column in a DB.

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

    Monday, June 6, 2016 2:04 PM
  • So the schema url is like a reference to the property name (or column name). Since both an Appointment and a Recipient have a property  for the SMTP address, they use the same schema url, but as in my case the appointment smtp property is empty (null) and the recipient isn't, it throws an error. Am I correct in this?

    Could it be that on my machine (with Outlook 2016) there is a different version of MAPI32.dll then on a machine where it does work (Outlook 2013)? And that is why I get the error on my machine and not on others?

    Grtz,

    B

    Monday, June 6, 2016 3:03 PM
  • This has absolutely nothing to do with the version of MAPI - Outlook, Exchange server, or some other app is free to set (or not set) that property. It is not required.

    Did you take a look at the message with OutlookSpy?


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

    Monday, June 6, 2016 3:28 PM
  • If I understand this then, Outlook 2016 in Office 365 Home edition doesn't set the property, but Outlook 2013 (stand-alone edition) does.  If every app is free to set or not set a property, isn't that a pain in the a** to develop?

    Not quit sure what I'm supposed to see in OutlookSpy, but at least now I can find out what hex values to use.

    When opening OutlookSpy from the main window I see a list of property tags. When opening OutlookSpy from the Meeting window, the list is empty (on the GetRecipientTable tab).

    In the list from the main windows I notice there is no mention of PR_SMTP_ADDRESS.

    PR_EMAIL_ADDRESS is present and works in the code, so I can debug some more ;)

    Grtz,

    B

    Monday, June 6, 2016 5:30 PM
  • You are missing my point. You should not expect any property to be present no matter what the Outlook version is.

    In your case and in my experience, PR_SMTP_ADDRESS will be missing for the SMTP recipients. PR_SMTP_ADDRESS is only present in the newer versions of Outlook/Exchange for the EX type recipients (as opposed to SMTP). What is the value of PR_ADDRTYPE in your case?

    To see the recipients from the IMessage window in an inspector, you need to make sure the item is saved. In case of a MeetingItem, you really need to be looking at the corresponding appointment (AppointmentItem) in the Calendar folder.


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

    Monday, June 6, 2016 5:49 PM
  • PR_ADDRTYPE = SMTP, so PR_SMTP_ADDRESS will not be present.

    That kind of logic just gives me headaches :( 

    Thanks for your time, it was a great help, I learned a little bit more on Outlook development.

    Grtz,

    B

    Tuesday, June 7, 2016 7:45 AM
  • Welcome to the club :-)

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

    Tuesday, June 7, 2016 6:13 PM