Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When retrieving an appointment with EWS the subject contains the organizer name

Im retrieving all appointments with EWS for a specific room in my office 365 account. When returning the appointment(s) the subject property of the appointment contains the name of the organizer instead of the subject i gave the appointment.

Im i doing something wrong?

Code example for how im doing it:

ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("username", "password");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");

DateTime StartDate = DateTime.Today.AddDays(-30);
DateTime EndDate = DateTime.Today.AddDays(60);
CalendarView cv = new CalendarView(StartDate, EndDate);
FolderId CalendarFolderId = new FolderId(WellKnownFolderName.Calendar, "[email protected]");

CalendarFolder calendar = CalendarFolder.Bind(service, CalendarFolderId);
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cv);

foreach (Appointment appointment in appointments.ToList())
{
    //this contains the wrong value.....
    string subject = appointment.Subject;

    //this is correct and has the same value as the incorrect subject
    string organizer = appointment.Organizer.Name;
}
like image 381
Marco Avatar asked Jun 27 '14 07:06

Marco


1 Answers

There is nothing wrong with your code but this is to do with the way the mailbox has been configured. With a Rooom Mailbox you can configured the Automatic processing setting using Remote Power-shell and the set-calendarprocessing cmdlet see http://technet.microsoft.com/en-us/library/dd335046(v=exchg.150).aspx eg

With your particular issue the Mailbox has been configured using the DeleteSubject parameter which "specifies whether to remove or keep the subject of incoming meeting requests. Valid input for this parameter is$true or $false. The default value is $true." and the AddOrganizerToSubject parameter which "specifies whether the meeting organizer's name is used as the subject of the meeting request. Valid input for this parameter is $true or $false. The default value is $true."

You won't be able to fix the existing data but if you reconigure the mailbox any new appointments sent will appear how you want

Cheers Glen

like image 110
Glen Scales Avatar answered Nov 10 '22 21:11

Glen Scales