none
Reading non-default calendars in C# with Exchange-WS RRS feed

  • Question

  • Hi,

    We are using the Exchange Calendar for classroom scheduling.  Each classroom is it's own calendar object (has it's own SAMAccountName) but there is a single calendar owner.  My task is to read all of the calendars and write the data to a database where the data will be used to create a webpage showing availability of all rooms graphically, rather than as a  textual table.  I'm writing in C# and my problem is that I don't know how to specify the individual calendars.  If I login as myself instead of the classroom calendar owner, I can easily dump my personal data using code I've cobbled together from multiple examples, but I need to be able to login as the classroom calendar owner and view not the default calendar, but rather numerous named calendars, each corresponding to a specific classroom.

    Has anybody done that before and do you have some sample code you're willing to share?

    Thanks,

    Rob Tanner

    Linfield College





    • Edited by caspersgrin Thursday, August 16, 2012 5:43 PM
    Thursday, August 16, 2012 5:15 PM

All replies

  • >> We are using the Exchange Calendar for classroom scheduling.  Each classroom is it's own calendar object (has it's own SAMAccountName) but there is a single calendar owner.

     Just to clarify are you saying that every Classroom has its own mailbox ? or are they just separate folders within one mailbox ? If each classroom has its own mailbox then the owner is always SAMAccount of the Mailbox.

    This is an important distinction as there are two ways you could access another users Mailbox with EWS the first is Impersonation where you impersonate the Mailbox owner and the other is delegation where you can access another mailbox's folders based on rights you have been assigned see http://blogs.msdn.com/b/exchangedev/archive/2009/06/15/exchange-impersonation-vs-delegate-access.aspx.

    To use delegation you just use the FolderId class and specify the mailbox you want to access eg

    FolderId otherUserCalendarId = new FolderId(WellKnownFolderName.Calendar, "targetMailbox@domain.com");
    CalendarFolder OtherUsersCalendare = CalendarFolder.Bind(service, otherUserCalendarId);
    Cheers
    Glen

    Friday, August 17, 2012 6:00 AM