none
How are UserProperties stored? Can I access a UserProperty from a shared inbox?

    Question

  • Hello,

    The add-on I am working on (VSTO Outlook 2013) stores UserProperties for mail items. Everything works as expected, but how will this work for shared accounts? We have users who, in addition to their default mailbox, have access to a second shared mailbox. How do UserProperties behave in this scenario? If an email comes in and a UserProperty is added to the new item (suppose triggered by NewMailEx event), would this be accessible immediately from another instance of the add-on running on another machine accessing the same mailbox? Does the race condition pose any issues? Would it be accessible at all? Is there a delay?

    I couldn't find any documentation on this, so I'd like a better idea of how this works.

    Thanks!

    Thursday, December 19, 2013 1:06 AM

Answers

  • Yes, you can access user properties from another mailbox - user properties definitions are stored in a special MAPI property (DASL name http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/85400102), while the values are stored as regular named MAPI properties.

    You can see both the blob and the property values in OutlookSpy - select a message with named properties set, click IMessage button on the OutlookSpy toolbar. You can also see them through the Outlook Object Model - click the Item button, select UserProperties property, click Browse, go to the IEnumVariant tab.


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

    Thursday, December 19, 2013 3:04 AM
  • Hello amr1986_

    Please take a look at the Changes to custom properties in Outlook article which states the following:

    To guarantee consistent use of custom properties, custom properties must already be used in the organization or on the Outlook client.  As soon as custom properties are being used or are registered, the custom properties can be freely transmitted to other Outlook clients or to servers that are running Exchange Server. The custom properties can also be sent over the Internet.

    Outlook ignores non-existing custom properties. If a custom property does not exist in the delivery store, the property will  not be created, and its value will be lost. If the custom property already exists in the delivery store, its value is persisted.

    In an Exchange environment, the term "store" as used in this article refers to a whole mailbox store (database). The term does not refer to an individual user's mailbox store. There may be one or more Exchange mailbox databases in an organization.

    So, your custom properties will be accessible from another machine/Outlook client.

    Thursday, December 19, 2013 3:05 PM

All replies

  • Yes, you can access user properties from another mailbox - user properties definitions are stored in a special MAPI property (DASL name http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/85400102), while the values are stored as regular named MAPI properties.

    You can see both the blob and the property values in OutlookSpy - select a message with named properties set, click IMessage button on the OutlookSpy toolbar. You can also see them through the Outlook Object Model - click the Item button, select UserProperties property, click Browse, go to the IEnumVariant tab.


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

    Thursday, December 19, 2013 3:04 AM
  • Hello amr1986_

    Please take a look at the Changes to custom properties in Outlook article which states the following:

    To guarantee consistent use of custom properties, custom properties must already be used in the organization or on the Outlook client.  As soon as custom properties are being used or are registered, the custom properties can be freely transmitted to other Outlook clients or to servers that are running Exchange Server. The custom properties can also be sent over the Internet.

    Outlook ignores non-existing custom properties. If a custom property does not exist in the delivery store, the property will  not be created, and its value will be lost. If the custom property already exists in the delivery store, its value is persisted.

    In an Exchange environment, the term "store" as used in this article refers to a whole mailbox store (database). The term does not refer to an individual user's mailbox store. There may be one or more Exchange mailbox databases in an organization.

    So, your custom properties will be accessible from another machine/Outlook client.

    Thursday, December 19, 2013 3:05 PM
  • Thank you Eugene and Dmitry.

    Eugene, I have one question. What do you mean when you say "Outlook ignores non-existing custom properties"? In what scenario would a custom property not exist? Is calling 

    item.UserProperties.Add(name, OlUserPropertyType.olText, false, true)

    with one client sufficient to register an Outlook user property?

    Thanks!

    Amit

    Thursday, December 19, 2013 3:57 PM
  • Named property tags are a finite resource: you can at most have 0xFFFF of them (per store). Once you run out, no new named properties can be created in that store.

    To prevent a Denial of Service Attack, messages delivered from the internet have the named properties copied from the MIME or TNEF envelope only if they already exist in the store.

    This does not apply at all in your situation: you are not sending messages, you are just reading existing ones from another mailbox, right?


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

    Thursday, December 19, 2013 4:30 PM
  • That is correct. All user properties will be applied to mail items stored on our local Exchange server. User Properties will be stored on Sent items, but not for the purpose of recipients accessing them.

    If I understand you correctly, a UserProperty stored on an outgoing mail item that remains within our Exchange network will be accessible by the recipient, (so sender's Sent item and recipient's received item will have the same UserProperty value), while a user property sent from another Outlook client outside our Exchange network will not, since it won't be registered on our internal store.

    If that is correct, I wasn't aware of this, and that is actually great news and I may be able to take advantage of it.

    I just needed to make sure that if two separate users are accessing the same mailbox from different machines, a MailItem UserProperty stored by one client will be accessible from the other, and it looks like it will.

    Thanks so much for the help.

    Thursday, December 19, 2013 5:51 PM
  • You can force named MAPI properties to be sent over SMTP if you set a special MAPI property (UseTnef) on the outgoing message.


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

    Thursday, December 19, 2013 5:55 PM