Till now I only psoted stuff I already figured out. Now it's time for something I don't know, yet. In current Outlook versions appointments may have some attribute called "label" (or "Beschriftung" in German) which defines the color of the entry in the list. Now the big question for me is: How may I get all appointments having a specific label? While searching around I found out you have to use the CDOEX API to access that field for doing that using VBA but I couldn't find the correkt C# API, yet. And even if that works: I still have to load all appointments and filter them myself. I'd prefer if Outlook or Exchange would do that directly, like by using the AdvancedSearch mechanism. Any pointers?
To open another person's calendar you have to know a name Outlook/Exchange can resolve. The format which seems to work best is "Lastname, Firstname":
Some basic code to fetch these entries might look something like that:
using Outlook = Microsoft.Office.Interop.Outlook;
/ ... /
// Login to Outlook and exchange
Outlook.Application outlook = new Outlook.Application();
Outlook.NameSpace mapi = outlook.GetNamespace("mapi");
mapi.Logon(null, null, true, true);
// Resolve the user
Outlook.Recipient rcp = mapi.CreateRecipient("Lastname, Firstname");
// Error handling - User not found!
// Get the calendar folder
Outlook.MAPIFolder calendar = mapi.GetSharedDefaultFolder(rcp, Outlook.OlDefaultFolders.olFolderCalendar);
Currently I'm working on a small C# application reading data from Outlook and Exchange and I decided to share some of the things I find - that can be interesting bahaviour or some API information. When starting to work with Oulook make sure you can resolve the hostname for Exchange. In Outlook's configuration dialog you can enter an IP adresse and authorization works but any further operation will try connection to Exchange using the hostname and fail with some random error message if that's not possible.