none
UserProperty added by EWS to MailItem not seen by Outlook RRS feed

  • Question

  • All,

    I am using a PropertyUpdate on Exchange 2007 EWS to add a property.

    <?xml version='1.0'?>
       <d:propertyupdate xmlns:d='DAV:' xmlns:mailheader='urn:schemas:mailheader:'>
          <d:set>
             <d:prop>
                    <OMS>YYY</OMS>
             </d:prop>
           </d:set>
       </d:propertyupdate>

    In Outlook 2007, If I add a column with the property name, I can see the value.

    However, VSTO 2007 (C#2010) does not find it.
    i.e. oItem.UserProperties.Find("OMS") returns null.

    OutlookSpy shows that UserProperties does not exist on the oItem. It makes an appearance if I programmatically change the value.

      if (oItem.UserProperties.Find("OMS") == null)
                oItem.UserProperties.Add("OMS", Outlook.OlUserPropertyType.olText, true, Type.Missing);
      oItem.UserProperties["OMS"].Value = "xxx";

    Any suggestions on why UserProperties doesn't get added when a property is added via EWS?

    Thursday, February 14, 2013 7:56 PM

Answers

  • Unless you use the Outlook PropertyAccessor object or use Outlook object model code to add the EWS extended properties you add to the UserProperties collection you cannot access an EWS extended property from the Outlook object model. That's the case even if you create the exended property in the PS_PUBLIC_STRINGS namespace.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Alex Abramov" <=?utf-8?B?QWxleCBBYnJhbW92?=> wrote in message news:e0bc779d-c3f1-4ac0-a811-256e85c009ba...
    Thank you.

    Ken Slovak MVP - Outlook
    Monday, February 18, 2013 6:58 PM

All replies

  • User properties definitions are stored in a special blob, while the values are stored as named MAPI properties. Your EWS code sets the latter but not the former.

    You can read the property value directly using MailItem.PropetyAccessor.GetProperty. The DASL name is shown by OutlookSpy when you click the IMessage button, select the property and look at the DASL edit box.


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

    Thursday, February 14, 2013 8:07 PM
  • Thank you, Dmitry, I can now access the MAPI property.

    However, is there a way to set the User Property definitions through EWS?
    Switching to PropertyAccessor.GetProperty is not ideal.

    Also, after installing OutlookSpy I get MDA warnings when I try to debug my VSTO Solution. Any way to get around that?

    Thursday, February 14, 2013 8:41 PM
  • Hi Alex,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into your thread to see whether they can help you out. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 18, 2013 2:28 AM
    Moderator
  • Thank you.
    Monday, February 18, 2013 2:52 PM
  • Unless you use the Outlook PropertyAccessor object or use Outlook object model code to add the EWS extended properties you add to the UserProperties collection you cannot access an EWS extended property from the Outlook object model. That's the case even if you create the exended property in the PS_PUBLIC_STRINGS namespace.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Alex Abramov" <=?utf-8?B?QWxleCBBYnJhbW92?=> wrote in message news:e0bc779d-c3f1-4ac0-a811-256e85c009ba...
    Thank you.

    Ken Slovak MVP - Outlook
    Monday, February 18, 2013 6:58 PM