none
How do I make a message with Extended properties appear in my Inbox?

    Question

  • I need to create and send email messages with some custom fields using Exchange Web Services (EWS), and be able to view those fields in Outlook, specifically to use them in custom views.

    I can successfully send a standard email using EWS and view it, but as soon as I add an Extended Property, it does not display in my Inbox.  (I get the pop-up notification, so I know I have got it, and I can use OutlookSpy to view the message and see the extended property, but it does not appear in any Outlook folder.)

    Is there any way to get Outlook to show these emails?

    I don't want custom message classes or custom forms in Outlook to create the email fields, I just want to see/group by them in the Inbox view.



    Peter Wood


    • Edited by Peter Wood Tuesday, December 11, 2012 8:15 AM
    Tuesday, December 11, 2012 8:12 AM

All replies

  • show us code how you create and send such message
    Tuesday, December 11, 2012 8:17 AM
  • The following sample code:

    • Connects to my Exchange server
    • Creates an email with the "ClientCode" extended property
    • Sends it to my Inbox.

    I get a popup notification which I can click (if I'm quick) to read the email, but it never shows in my Outlook Inbox.

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
    service.Credentials = new WebCredentials("DOMAIN\\peterwo", "password");
    service.AutodiscoverUrl("peterwo@nospam.com");
    
    ExtendedPropertyDefinition clientCode = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "ClientCode", MapiPropertyType.String);
    
    EmailMessage message = new EmailMessage(service);
    message.SetExtendedProperty(clientCode, "MYCLI");
    message.Subject = String.Format("Test subject {0} - {1}", message.ExtendedProperties.Count > 0 ? message.ExtendedProperties[0].Value : "NO CLIENT CODE", Guid.NewGuid());
    message.Body = "Test email body";
    message.ToRecipients.Add("peterwo@nospam.com");
    message.SendAndSaveCopy();

    If I comment out the line:

    // message.SetExtendedProperty(clientCode, "MYCLI");

    so that the message has no extended property, I can see it in my Inbox.


    Peter Wood

    Tuesday, December 11, 2012 9:29 AM
  • i will try to reproduce it later today or tomorrow morning.
    Tuesday, December 11, 2012 10:10 AM
  • used your code almost verbatim, mail appeared in my inbox with proper extended property. so i cannot reproduce it, sorry.

    what i changed:

    webcredentials should be passed differently - split user and domain: user, pass, domain

    i set up manual Url, but that should not be the issue. also my exchange is 2007 but that is nothing i can change.

    Tuesday, December 11, 2012 1:33 PM
  • What exactly do you mean by "it does not display in my Inbox"?

    Do you mean Outlook does not display it as one of the columns in the Inbox folder? Did you configure the view to show that property?

    Also, when you generate the named property, why do you always create a new GUID? Would you not want to use the predefined GUID used by the user propertiers in Outlook (PS_PUBLIC_STRINGS)?


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

    Tuesday, December 11, 2012 5:26 PM
  • Hi Peter,

    Even I was not able to reproduce the issue in my test environment.

    As Dmitry has mentioned, even I am not sure about what exactly do you mean by "it does not display in my Inbox". It would be helpful if you could elaborate on that part. Also let us know if use of predefined GUID help you to resolve the issue.

    Thanks,

    Shailesh G. Rajput
    _________________________________________
    Microsoft Developer Support - Messaging & Collaboration

    Saturday, December 15, 2012 4:51 AM