This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 1.74 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public bool IsAppointmentVerifiedWithResource(Patron userSessionObj, Reservation reservation)
  2.     {
  3.         var emailConfig = new DataStoreManager.ConfigurationManager();
  4.         var serviceBinding = emailConfig.GetConfiguration(Configuration.GetConfigurationName(Resource_ConfigurationConstants.ExchangeServiceBinding));
  5.  
  6.         // Create the binding.
  7.         var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
  8.         {
  9.             UseDefaultCredentials = true,
  10.             Url = new Uri(serviceBinding)
  11.         };
  12.  
  13.         // Set the calendar view to use
  14.         var view = new CalendarView(reservation.Start, reservation.End);
  15.  
  16.         // Get the target folder ID using the email address
  17.         var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(reservation.EmailAddress));
  18.  
  19.         view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
  20.  
  21.         if (CheckForApptCount(service, folder, view))
  22.         {
  23.             var response = service.FindAppointments(folder, view);
  24.  
  25.             service.LoadPropertiesForItems(from Item item in response select item, BasePropertySet.FirstClassProperties);
  26.  
  27.             foreach (Appointment apt in response.Items)
  28.             {
  29.                 foreach(Attendee at in apt.RequiredAttendees)
  30.                 {
  31.                     //room mailbox matches required attendee
  32.                     if(at.Address == reservation.EmailAddress)
  33.                     {
  34.                         ******at.ResponseType always = Unknown******
  35.                         if(at.ResponseType == MeetingResponseType.Accept)
  36.                         {
  37.                             return true;
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.  
  43.         }
  44.  
  45.         return false;
  46.  
  47.     }
clone this paste RAW Paste Data