Exchange Web Services and Property Sets

I need to get calendar information by calling Exchange web service in BPOS. I use CalendarView with PropertySet to get as little data as possible. However, property sets are apparently limited. I need the EmailAddress the one who made the calendar appointment, so I thought I could use AppointmentSchema.Organizer in the PropertySet .

When you receive the whole meeting, I can receive the email through appt.Organizer.EmailAddress . But with the code below Organizer.EmailAddress always null. I turned on the trace and checked it, and only the Organizer.Name property was sent, nothing more. Does anyone have a solution on how to get EmailAddress when using PropertySet ?

 CalendarView view = new CalendarView(dtFrom, dtTo); view.PropertySet = new PropertySet(ItemSchema.Subject); view.PropertySet.Add(ItemSchema.Id); view.PropertySet.Add(AppointmentSchema.Start); view.PropertySet.Add(AppointmentSchema.End); view.PropertySet.Add(AppointmentSchema.Organizer); // This should contain EmailAddress but it doesn't Mailbox mailbox = new Mailbox(" myemail@test.ab "); FolderId id = new FolderId(WellKnownFolderName.Calendar, mailbox); CalendarFolder folder = CalendarFolder.Bind(service, id); FindItemsResults<Appointment> findResults = folder.FindAppointments(view); 
+6
exchangewebservices ews-managed-api
source share
3 answers

This should work (for me):

 service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(start, end)).Where(s => DateTime.Now < s.Start); service.LoadPropertiesForItems(appointments, PropertySet.FirstClassProperties); 
+6
source share

As far as I was able to figure out, EWS is a little mistaken when it comes to filling out all the EmailAddress information, both in the "Appointments for the Organizer" and for other things such as "EmailMessage.From". When you execute a query for multiple items, you do not receive the fully populated EmailAddress properties. For example. using the API:

 Folder.FindItems ExchangeService.FindAppointments 

I found that only the display name in the EmailAddress fields is populated.

To completely fill out EmailAddress, I need to load / bind to a specific element and specify the corresponding EmailAddress property, for example. Purpose of Schema.Organizer in your case. Therefore, although you specify the exact same property to load, you are loaded by calling a single element, not a bulk request. For example. through:

 ServiceObject.Load 

which is available for both Destination and EmailMessage, as they both exit ServiceObject. Using Item.Bind with an appropriate defined set of properties should also work.

As an aside, I realized this by looking at the code for EwsEditor, which is mentioned here:

http://blogs.msdn.com/webdav_101/archive/2009/11/10/ews-has-more-happy-now-ews-managed-api-and-ewseditor.aspx

The usability of EwsEditor is pretty sucking, and the code requires some trawling to understand, but at least it shows examples of many API implementations.

+1
source share
 service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(start, end)).Where(s => DateTime.Now < s.Start); service.LoadPropertiesForItems(appointments, PropertySet.FirstClassProperties); 

It worked for me.

0
source share

All Articles