2
votes

I'm trying to set up a system that displays calendar items from a resource calendar on a web page using Exchange 2007 and EWS (Exchange Web Services).

I've managed to get access to the calendars of the resources, but when getting the items in the calendars, the subject of each calendar item is not the original subject used when someone created the meeting request and invited the resource, but rather the Username on the account that created the the meeting request eg. if I do something like:

List<CalendarItemType> items = 
    Calendar.GetCalendarItems("[email protected]", 
                              Calendar.GetNextWeekView(), 
                              binding);
if (items.Count > 0)
{
    Console.WriteLine(string.Format("Calendar opened - fetched {0} items",
                                    items.Count));
    Console.WriteLine("===================================");
    foreach (var item in items)
    {
        Console.WriteLine();
        Console.WriteLine(item.Subject);
        Console.WriteLine("----------------------------------------");
        Console.WriteLine("\tOrganizer: " + item.Organizer.Item.Name);
        Console.WriteLine();
        Console.WriteLine("\tStart:     " + item.Start.ToString("dd-MM-yyyy HH:mm"));
        Console.WriteLine("\tSlut:      " + item.Start.ToString("dd-MM-yyyy HH:mm"));
    }
}

Where Calendar.GetCalendarItems, is a method that fetches the calendar items of the resource denoted by the first argument, the Calendar.GetNextWeekView() is a static method that creates a CalendarView spanning the next week from today's date, and the binding is set up to use an account with delegate access to the resource mailbox.

The item.Subject comes out as Administrator if the Administrator account was used to book the resource.

Does anyone know how to remedy this - do I need to make some kind of special property access, or fetch another type of item or what?

Regards Jesper Hauge

1
Figured this one out myself see answer belowHauge

1 Answers

2
votes

Figured this one out - when I started looking outside the code.

Answer lies in resource configuration rather than access code.

If you want to have the subject of the meeting reflect the original subject. Make sure the resource has set the setting properties DeleteSubject and AddOrganizerToSubject to false. It can be achieved with the following shell command:

Set-MailboxCalendarSettings resourcename -DeleteSubject 0 -AddOrganizerToSubject 0

Regards Jesper Hauge