c# - How to get all appointments including the private ones? -
i want list outlook appointment times in specific time range , interested in start , end time of appointments.
i'm using code far:
datetime starttime = datetime.now.adddays(2); datetime endtime = datetime.now.adddays(3); var outlookapplication = new outlook.application(); outlook.namespace outlooknamespace = outlookapplication.getnamespace("mapi"); var recip = outlooknamespace.createrecipient("<valid contact>"); if (recip.resolve()) { var calendaritems = outlooknamespace.getshareddefaultfolder(recip, oldefaultfolders.olfoldercalendar).items; calendaritems.includerecurrences = true; var filter = string.format("[start] >= '{0}' , [end] < '{1}'", starttime.toshortdatestring(), endtime.toshortdatestring()); calendaritems.sort("[start]"); calendaritems = calendaritems.restrict(filter); var result = calendaritems.cast<appointmentitem>().select(x => x); }
the code retrieves appointments, not private ones. how can private appointments too?
outlook filters out private appointments form shared folders if accessible using mapi. if using redemption option, can use rdofolder.getactivitiesfortimerange - returns private appointments.
Comments
Post a Comment