locked
EWS: Only able to retrieve some user defined fields RRS feed

  • Question

  • 

    Hi

    I can't figure out why I only partly can load userdefined fields trough E

    WS.Below the important part of the code in question.

    Only userdefined fileds "Liga" and "AntalDeltid" are loaded into the extendedproperties in foundcontact....not he other two.

    I have checked with Outlook where I can access the missing fields and all of them contains a value.

    Anybody having an idea where to look for a solution?

    - Allan

    Dim USER_Liga As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "Liga", MapiPropertyType.String)
    Dim USER_Fuldtids As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AntalFuldtids", MapiPropertyType.Integer)
    Dim USER_Deltid As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AntalDeltid", MapiPropertyType.Integer)
    Dim USER_Amatører As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AntalAmatører", MapiPropertyType.Integer)
         
    
    Dim view As New ItemView(pageSize, offset, OffsetBasePoint.Beginning)
    view.OrderBy.Add(ContactSchema.DisplayName, SortDirection.Ascending)
    
    view.PropertySet = New PropertySet(BasePropertySet.FirstClassProperties)
    view.PropertySet.Add(USER_Liga)
    view.PropertySet.Add(USER_Fuldtids)
    view.PropertySet.Add(USER_Amatører)
    view.PropertySet.Add(USER_Deltid)
    
    Dim foundItems As FindItemsResults(Of Item) = service.FindItems(correctfolder.Id, searchFilter, view)
    
    For Each kontakt In foundItems
    	If TypeOf kontakt Is Contact Then
    		Dim foundContact As Contact = kontakt
    		foundContact.Load(view.PropertySet)
    			.
    			.
    			.





    • Edited by AllanReese Thursday, August 6, 2015 2:52 PM
    Thursday, August 6, 2015 2:37 PM

Answers

  • I'd suggest you enable tracing https://msdn.microsoft.com/en-us/library/office/dd633676(v=exchg.80).aspx on your requests and also check the properties using a MAPI editor like OutlookSpy or MFCMapi if you using the wrong MapiPropertyType then a property won't be returned. The other thing I would suggest is try setting the property using EWS on a test item and then try to retrieve those properties.

    Cheers
    Glen

    • Marked as answer by AllanReese Saturday, August 8, 2015 8:25 AM
    Friday, August 7, 2015 2:45 AM

All replies

  • I'd suggest you enable tracing https://msdn.microsoft.com/en-us/library/office/dd633676(v=exchg.80).aspx on your requests and also check the properties using a MAPI editor like OutlookSpy or MFCMapi if you using the wrong MapiPropertyType then a property won't be returned. The other thing I would suggest is try setting the property using EWS on a test item and then try to retrieve those properties.

    Cheers
    Glen

    • Marked as answer by AllanReese Saturday, August 8, 2015 8:25 AM
    Friday, August 7, 2015 2:45 AM
  • Hi Glen

    Good suggestions which led to identifying one error. The missing values was coursed because I should have defined the extended property as a double because that was the type in Outlook.

    But I know are facing another problem. I also retrieve a couple of dates from an Outlook contact item. Some dates in outlook are set to "None" which internally in Outlook is refered to as the date #1/1/4501# but when retrieved I get the date #1/1/2001# (also checked with EWSEditor). Main problem here is that a retrieval time I can not identify the differences between retrieving #1/1/4501# or  #1/1/2001#.

    Do you know a workaround for that?

     - Allan

    Saturday, August 8, 2015 8:19 AM