3

If I have a CalendarFolder (via it's folderId) how do I find the associated DeletedItems folder where deleted appointments would be put?

In Exchange, Rooms have their own CalendarFolder and DeletedItems folder. I have the FolderId for a Room's CalendarFolder. This allows me to authenticate as a user and find all the appointments for that room's calendar (I have appropriate permissions).

String folderId = "AAMK[snip]M==";

service = new ExchangeService(ExchangeVersion.<version>);
CalendarFolder folder = CalendarFolder.Bind(service, new FolderId(folderId));
CalendarView view = new CalendarView(new DateTime.Now, new DateTime.Now.AddDays(14));

FindItemsResults<Appointment> appointments = folder.FindAppointments(view);

I want to also return the deleted appointments (if any) associated with that room. If I had the room's email address I could do this:

String roomEmailAddress = "room@domain.com"; // I don't have this
MailBox roomMailBox = new Mailbox(roomEmailAddress);
Folder deletedItemsFolder = Folder.Bind(service, new FolderId(WellKnownFolderName.DeletedItems, roomMailbox);

ItemView view = new ItemView(10);
SearchFilter isAppointmentSearch = new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "IPM.Appointment");
var deletedAppointments = deletedItemsFolder.FindItems(isAppointmentSearch, view)

However, I don't have the room's email address only the folder id for it's calendar.

Given a CalendarFolder, to find the associated DeletedItems folder where deleted appointments would be put, so far I've tried:

  1. Folder deletedItemsFolder = Folder.Bind(service, new FolderId(WellKnownFolderName.DeletedItems) but I get the User's DeleteItems folder not the Room's
  2. search the ParentFolder of the CalendarFolder for the DeletedItems sibling folder, but only got the User's deleted items folder
  3. tried to get the email address from the CalendarFolder but it doesn't seem like you can
The Doctor
  • 334
  • 3
  • 11

1 Answers1

0

Okay having joined and gotten active on this platform I will take a stab at this question.

With regards to how you connect to a Room Calendar you may want to view the comments on Accessing a Resource Calendar with no mailbox via EWS and C#

As to where the "Deleted Items" get stored it depends on what it is set in Outlook. For more of an understanding see https://support.microsoft.com/en-gb/help/202517/items-that-are-deleted-from-a-shared-mailbox-go-to-the-wrong-folder-in-outlook

Which offers the answer in a roundabout sort of way.

Better late than never!

Community
  • 1
  • 1
RR_SH
  • 58
  • 9