none
MAPI unable to read Extended properties created by EWS Managed API RRS feed

  • Question

  • Hi,

    I have 2 different applications. One for reading emails and the other for sending emails. I am sending emails using EWS managed API.

    Here is the code..

    Dim exch As ExchangeService = New ExchangeService(ExchangeVersion.Exchange2010)

    exch.Url = New Uri("exchange web service address")
                exch.UseDefaultCredentials = False
                exch.Credentials = New System.Net.NetworkCredential("username", "password", "domain")
                exch.ImpersonatedUserId = New ImpersonatedUserId(ConnectingIdType.SmtpAddress, "emailaddress")

                'Dim myGuid As Guid = New Guid("0006200E-0000-0000-C000-000000000046")

                Dim Hyperlink As New ExtendedPropertyDefinition(myGuid, "Hyperlink", MapiPropertyType.String)
                Dim Policy As New ExtendedPropertyDefinition(myGuid, "Policy", MapiPropertyType.String)
                Dim Policy_type As New ExtendedPropertyDefinition(myGuid, "Policy_type", MapiPropertyType.String)
                Dim mailhook As New ExtendedPropertyDefinition(myGuid, "mailhook", MapiPropertyType.String)
                Dim Mailbox As New ExtendedPropertyDefinition(myGuid, "Mailbox", MapiPropertyType.String)

                Dim emailMsg As EmailMessage = New EmailMessage(exch)
                emailMsg.ToRecipients.Add("email address")
                emailMsg.Subject = "EWS Work Subject"
                emailMsg.Body = "EWS Work description"
                emailMsg.SetExtendedProperty(prop, "123asd")
                emailMsg.SetExtendedProperty(Hyperlink, "address")
                emailMsg.SetExtendedProperty(Policy, "123ABCEWS")
                emailMsg.SetExtendedProperty(Policy_type, "EWS")
                emailMsg.SetExtendedProperty(mailhook, "FALSE")
                emailMsg.SetExtendedProperty(Mailbox, "EWS123")
                emailMsg.Save()
                emailMsg.Send() ...........................................But these fields I am not able to read through MAPI. Is it possible to do so ? 

    Monday, May 21, 2012 3:47 PM

Answers

  • > I am using CDO MAPI to read those fields

    Okay I would still try to use Mapi editor to look at the Items as your CDO code maybe at fault the Mapi editor will tell you exactly what is accessible on a message.

    > different Exchange servers

    Different Servers in the same Exchange Organization or different servers is two different Exchange Orgs if its two different orgs then if you don't have a remote domain setup http://technet.microsoft.com/en-us/library/aa996309.aspx to allow Exchange rich text format (RTF) then you loose the properties when the Message is converted to MIME. (Within the same org it shouldn't be a problem)

    Cheers
    Glen

    • Marked as answer by pkgupta Wednesday, May 23, 2012 11:20 AM
    Tuesday, May 22, 2012 11:49 AM

All replies

  • When you say you can't read them using Mapi what do actually mean ? Eg are you using the OOM, Exmapi etc. Have you had a look at the Message in the SentItems folder using a Mapi editor like OutlookSpy or MFCMapi to ensure your Mapi properties are getting created okay?. Is the recipient your sending too located in the same Exchange Organization ?

    Also why are you using the StickyNote GUID for custom properties you should use the DefaultExtendedPropertySet.PublicStrings for any custom properties.

    Cheers
    Glen

    Tuesday, May 22, 2012 6:33 AM
  • I am using CDO MAPI to read those fields. And I also tried DefaultExtendedPropertySet.PublicStrings for my custom fields but the same result.  And both the sender and receiver are on different Exchange servers. Could that be a reason that i am not able to read the custom fields ?

    Thanks

    pk


    Prateek

    Tuesday, May 22, 2012 11:12 AM
  • > I am using CDO MAPI to read those fields

    Okay I would still try to use Mapi editor to look at the Items as your CDO code maybe at fault the Mapi editor will tell you exactly what is accessible on a message.

    > different Exchange servers

    Different Servers in the same Exchange Organization or different servers is two different Exchange Orgs if its two different orgs then if you don't have a remote domain setup http://technet.microsoft.com/en-us/library/aa996309.aspx to allow Exchange rich text format (RTF) then you loose the properties when the Message is converted to MIME. (Within the same org it shouldn't be a problem)

    Cheers
    Glen

    • Marked as answer by pkgupta Wednesday, May 23, 2012 11:20 AM
    Tuesday, May 22, 2012 11:49 AM
  • Hi Glen!

    Thanks for the info on the Exchange Orgs. My sending mailbox was on a different Exchange Org than the receiving mailbox. I tried sending the mails to the mailbox within the same Exchange Org and it worked.

    Thanks

    Pk


    Prateek

    Wednesday, May 23, 2012 11:23 AM