EWS: Only able to retrieve some user defined fields


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_Amatrer As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AntalAmatrer", 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_Amatrer)
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 06, 2015 2:52 PM
August 6th, 2015 2:37pm

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 08, 2015 8:25 AM
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2015 2:45am

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

August 8th, 2015 8:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics