
Untitled
By: a guest on
Jan 4th, 2013 | syntax:
None | size: 1.74 KB | hits: 17 | expires: Never
public bool IsAppointmentVerifiedWithResource(Patron userSessionObj, Reservation reservation)
{
var emailConfig = new DataStoreManager.ConfigurationManager();
var serviceBinding = emailConfig.GetConfiguration(Configuration.GetConfigurationName(Resource_ConfigurationConstants.ExchangeServiceBinding));
// Create the binding.
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
{
UseDefaultCredentials = true,
Url = new Uri(serviceBinding)
};
// Set the calendar view to use
var view = new CalendarView(reservation.Start, reservation.End);
// Get the target folder ID using the email address
var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(reservation.EmailAddress));
view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
if (CheckForApptCount(service, folder, view))
{
var response = service.FindAppointments(folder, view);
service.LoadPropertiesForItems(from Item item in response select item, BasePropertySet.FirstClassProperties);
foreach (Appointment apt in response.Items)
{
foreach(Attendee at in apt.RequiredAttendees)
{
//room mailbox matches required attendee
if(at.Address == reservation.EmailAddress)
{
******at.ResponseType always = Unknown******
if(at.ResponseType == MeetingResponseType.Accept)
{
return true;
}
}
}
}
}
return false;
}