oAppt1 = oOutlook.CreateItem( olAppointmentItem )create the item in the ACME5 subcal folder. Am using the following:
#DEFINE olAppointmentItem 1 #DEFINE olTaskItem 3 #DEFINE CR CHR(13) #DEFINE olFolderCalendar 9 cPK = "0000000001" && pk value of item to add LOCAL oNameSpace, oAppt1, oAppt2, oTask1, oTask2 IF VarType(oOutlook) <> "O" RELEASE oOutlook PUBLIC oOutlook oOutlook = CreateObject("Outlook.Application") ENDIF oNameSpace = oOutlook.GetNameSpace("MAPI") oCal=oNameSpace.GetDefaultFolder(olFolderCalendar) set step on IF TYPE('oCal.Folders("ACME5")') = "O" *--- already defined, dont add loSubCal = oCal.folders("ACME5") ELSE loSubCal = oCal.folders.Add("ACME5") ENDIF oCal=oNameSpace.GetDefaultFolder(olFolderCalendar).Folders("ACME5") cFindStr = '[Location] = "' + cPK + '"' oAppt1 = loSubCal.Items.Find( '&cFindStr.' ) IF TYPE('oAppt1') = "O" lFound = IIF(ISNULL(oAppt1), .f. , .t. ) ENDIF IF ! lFound *--- *--- appointment gets created in default CAL folder; NOT in ACME5 *--- oAppt1 = oOutlook.CreateItem( olAppointmentItem ) ENDIF WITH oAppt1 .Start = DTOT( DATE() + 7 ) .End = DTOT( DATE() + 8 ) .AllDayEvent = .T. .Location = cPK .Body = "Pull wisdom teeth" .ReminderSet = .F. .Subject = "Doctor Appointment" .Save() ENDWITH RELEASE oOutlook RETURN>>How do u find an EXISTING outlook APPOINTMENT item and update/delete it? With outlook CONTACTS, there are several fields that can be populated with a PK value. You can then search for this PK value and update the contact if found or add new if not found. Cant find any appointment fields that can be used in similar manner. Cant search on the appointment's start/end and subject fields cuz they could have changed in the VFP table.
>oOutlook=CreateObject("Outlook.Application") >oNS = oOutlook.GetNameSpace("MAPI") >oCalendar = oNS.GetDefaultFolder(9) >oItems = oCalendar.Items >oMyItem = oItems.GetItemFromId( cEntryID ) >* To change the item, set properties here, then: >oMyItem.Save() > >* To delete the item: >oMyItem.Delete() >>