Search an Appointment in Outlook

I make a routine to create an appopintmentitem in a Userx Calendar of Company PublicFolder: it works very fine… When I try to search an appointment (by subject for example) in a userx calendar my routine fail if the string that I search for doesn’t match with any of appointments subject. This is code: OuFolder2 := OuFolder1.Folders.Item(‘UserXCalendar’); AppointmentItem:=OuFolder2.Items.Find(SearchStr);/// This fail because OuFolder2.Items.Find(SearchStr) returns an empty object Using VB there is TypeName Function for Test… any suggestions for NAVI? bye.

I’m afraid there’s no solution in Navision as Fin is unable to handle exceptions. In your case the OCX would return a NIL as Appointment Item. I encountered a similar problem with Outlook automation when I wanted to scan for Contacts and a ContactGroup Item was returned. The only solution seems to be to write a wrapper OCX which allows you to scan first whether or not an appropriate Item exists. Such as: If AppointmentExists(SearchStr) then AppointmentItem:=OuFolder2.Items.Find(SearchStr); Marcus Marcus Fabian phone: +41 79 4397872

I Find a solution: remember that OuFolder is a MAPI folder… OuFolder2 := OuFolder1.Folders.Item(“Calendar Public Folder”); FOR i:=1 TO OuFolder2.Items.Count DO BEGIN AppointmentItem:=OuFolder2.Items.Item(i); IF AppointmentItem.Subject=SearchObj THEN BEGIN AppFind:=TRUE; CalendarName:=OuFolder2.Name; EXIT; END; END; This is not “the best”… but works Bye rodry