0
votes

I am developing a VSTO outlook addin, that will create an appointment/meeting. I use the following code to create the appointment/meeting:

Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olAppointmentItem)

If the user clicks into a different calendar ( second account or an account that they have delegate access) to how can I create the appointment in the selected calendar?

I know I can do this with the below code but how do I get the correct folder ?

items = calendarFolder.Items;
appItem = items.Add(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
appItem.Save();
appItem.Display(true);
1

1 Answers

1
votes

If you want the currently selected folder to create an appointment in, use Application.ActiveExplorer.CurrentFolder. If you want the Calendar folder in a store other than the default one, use Store.GetDEfaultFolder(olFolderCalendar) (where Store comes from the Application.Session.Stores collection). If you want Calendar folder from another Exchange mailbox, call Application.Session.GetSharedDefaultFolder (Recipient object needed by GetSharedDefaultFolder can come from Application.Session.CreateRecipient).