Correct way to request calendar items via managed aps?

I have the following code:

var startProp = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, "DTSTART", MapiPropertyType.String); var endProp = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, "DTEND", MapiPropertyType.String); var cond1 = new SearchFilter.IsEqualTo(startProp, StartDate); var cond2 = new SearchFilter.IsEqualTo(endProp, EndDate); var filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, cond1, cond2); var items = svc.FindItems(WellKnownFolderName.Calendar, filter, view); 

I am trying to run this request in an exchanger mailbox. (However, this is not obvious in the code above). It may have a reservation with the exact start / end time. Therefore, if there is one clause matching these criteria, I should get at least one element.

Background to this: Think of a conference room, and people are trying to block it for a meeting. When exchanging, this is another mailbox, similar to the user's mailbox. Thus, upon successful booking, this mailbox receives an email with calendar information (iCalendar format ( *.ics ).

I am stuck on two different accounts ...

  • items do not return anything in the code above. The value of TotalCount is zero. Maybe I'm doing something wrong with the api. I can’t understand it.

  • I am really confused by what I am trying to request. I do not understand the exchange decision in this matter. This is described below.

So, you have the email items in your inbox. Each email has a built-in calendar, usually with some base64 encoding. The calendar has a certain pattern - we are only interested in the data that you find between VEVENTS (i.e. BEGIN: VEVENT and END: VEVENT). The problem here is that there can sometimes be several VEVENTS. So how does exchange really do it? Does it go through all VEVENTS, meets the criteria; if it matches the result, does it return this β€œletter” (with an attached / integrated calendar)? Or is it some other mechanism?

Therefore, I am not sure about the semantics that I wrote in the code above. Therefore, please report this.

+7
email calendar exchange-server-2010 ews-managed-api
source share
1 answer

Found the answer to the first part:

 static void Find(DateTime Start, DateTime End, ExchangeService svc) { var filter1 = new SearchFilter.IsGreaterThanOrEqualTo(MeetingRequestSchema.Start, Start); var filter2 = new SearchFilter.IsLessThanOrEqualTo(MeetingRequestSchema.End, End); var filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, filter1, filter2); var vw = new ItemView(99); var items = svc.FindItems(WellKnownFolderName.Calendar, filter, vw); Console.WriteLine("Count: {0}", items.TotalCount); } 
+1
source share

All Articles