none
Getting basic values from contact form using EWS RRS feed

  • Question

  • Using Exchange Server 2010 and progrmming VB.net.

    I am trying to get values from an exchange search through EWS. I have managed to get values from my extended userproperties in Outlook contacts with this:

    • Dim USER_iban As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "iban", MapiPropertyType.String)
    • view.PropertySet = New PropertySet(BasePropertySet.FirstClassProperties, New PropertyDefinitionBase() {USER_cprnr, USER_Type, USER_BS})
    • Dim foundItems As FindItemsResults(Of Item) = service.FindItems(correctfolder.Id, searchFilter, view)

    Works just great. But I am unable retrieve values from fields not in the set of firstclassproperties - like ContactSchema.Birtday.

    I have tried with

    • view.PropertySet = New PropertySet(BasePropertySet.FirstClassProperties, New PropertyDefinitionBase() {USER_cprnr, USER_Type, USER_BS, ContactSchema.Birthday})

    or

    • view.PropertySet.Add(ContactSchema.Birthday)

    but all the time I get this kind of error: {"This property was requested, but it wasn't returned by the server."}

    

    Are you able to point me in a direction to find a solution?

     - Allan

    
    • Edited by AllanReese Thursday, January 8, 2015 4:14 PM
    Thursday, January 8, 2015 12:32 PM

All replies

  • The property isn't returned by the server if it isn't set, and you'll see that error. If the contact has a value for the Birthday field, it should be returned.
    Thursday, January 8, 2015 4:14 PM
    Moderator
  • Well, I have noticed a couple of posts regarding this but in my case I have a small test environment with 12 contacts and the property is set in all contacts.

    I could imagine that the value is not returned because "birthday" not is in the firstpropertyset - or is that not likely?

    - Allan

    Thursday, January 8, 2015 8:29 PM
  • When I sanity-tested this (against Office 365), Birthday was returned when I only requested FirstClassProperties, but only on contacts that actually have it set. For ones that did not, it showed the error you mentioned. It's possible that Exchange 2010 handles it differently, but I wouldn't expect so. You might download EWSEditor and explore those contacts, see if it has trouble reading the Birthday. Out of curiosity, how did you set the Birthday field on those contacts? Outlook/Outlook Web App?
    Friday, January 9, 2015 7:57 PM
    Moderator
  • Thank you for you reply.

    I will try EWSeditor.

    The dates are set trrough Outlook client.

    During my testing I also tried

    • If foundContact.TryGetProperty(ContactSchema.Birthday, fdag) Then

    The test never turns out True but I guess this could be correct if either the date not is set or the value not is returned.

    I find it a bit strange. Could the error be related to locale settings? I use Danish standard with dd-mm-yy.

    In this forum I am able to provide you with screenshots so it's not that easy to provide you with evidence of the settings i use:-)

    Saturday, January 10, 2015 9:54 AM
  • I have been playing around with the EWSeditor and unfortunately I am not able to have Birthday included in the FirstClassporperty set. I have no problem retrieving the 12 contacts I have in my test environment (folder) but I find it impossible to get the Birthday of the contacts.

    The contacts I try to investigate are not "normal" contacts. I have designed them in another messageclass. Does that meen anything regarding the error?

    Sunday, January 11, 2015 9:36 PM
  • That's likely. If the data isn't in the standard Birthday field, it's not going to work. You might want to create a regular contact and set the Birthday with Outlook and confirm that you can retrieve the property. Then you could use a tool like MFCMapi to view the MAPI properties and compare what's different.
    Wednesday, January 14, 2015 4:59 PM
    Moderator
  • It's a different messageclass but the wanted data resides in the default field for birthdays.

    I tried to reconfigure my test environment. Deleting the old 12 contacts and copying the samme 12 contacts from my base folder. Now it's working but I don't have ANY clue on what were wrong earlier but nevertheless I don't have any problems retrieving the birthdays anymore - and I sure hope I won't see the problem again:-)

    Thank you for your time.

     - Allan

    Wednesday, January 14, 2015 9:01 PM