问题
I'm creating an Outlook add-in and i'd like to know how to get elements from a selected calendar? For exemple, i need to get all Appointments items from a calendar named "myCalendar". Now, i can just get all appointments items from ALL calendars.
thank you,
回答1:
Those extra Calendars are available as subfolders of the main Calendar folder. So here is what you do:
Get a reference to the main calendar folder using
Outlook.MAPIFolder calendar = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Enumerate the
calendar.Folders
collection until you find one with theMAPIFolder.Name
you are looking for.From that MAPIFolder, enumerate all
Items
asOutlook.AppointmentItem
like you are already doing.
来源:https://stackoverflow.com/questions/7120681/outlook-addin-get-elements-from-a-selected-calendar