IF llContinue llRedemption = .F. IF ZCHECKSERVER("Redemption.SafeMailItem") llRedemption = .T. ELSE IF ISFILETHERE( ADDBS(GETENV("SystemRoot"))+"system32\" + "Redemption.dll" ) lcDlL = ADDBS(GETENV("SystemRoot"))+"system32\" + "Redemption.dll" RUN regsvr32.EXE /s &lcDlL llRedemption = ZCHECKSERVER("Redemption.SafeAppointmentItem") ELSE llRedemption = .F. ENDIF ENDIF loOutLook=CREATEOBJECT("outlook.application") loNameSpace = loOutLook.GetNameSpace('MAPI') loNameSpace.Logon() lnSentDate=VFPDateToClarion(DATE()) SELECT cAppointments SCAN FOR lSendAppt IF ( llRedemption ) loAppt = CREATEOBJECT('Redemption.SafeAppointmentItem') && open redemption loAppt.ITEM = loOutLook.createitem(1) && create safe item object ELSE loAppt=loOutLook.createitem(1) ENDIF loAppt.Start = cAppointments.tApptStart loAppt.End = cAppointments.tApptEnd loAppt.AllDayEvent=(cAppointments.tApptStart=TTOD(cAppointments.tApptStart)) && Time wasn't specified loAppt.MeetingStatus = 1 && olMeeting loAppt.Subject=ALLTRIM(cAppointments.Service_Code)+": "+ALLTRIM(cAppointments.cTech1)+" Assist: "+IIF(EMPTY(cAppointments.cTech2),"none",ALLTRIM(cAppointments.cTech2))+" - "+ALLTRIM(cAppointments.cName) TEXT TO lcBody TEXTMERGE NOSHOW PRETEXT 1+2 Scheduled by: <<cAppointments.cScheduler>> When: <<IIF(loAppt.AllDayEvent,TRANSFORM(TTOD(cAppointments.tApptStart),"@YL"),TRANSFORM(cAppointments.tApptStart,"@YL")+"-"+LTRIM(TTOC(cAppointments.tApptEnd,2),1,"0"))>> (GMT-06:00) Central Time (US & Canada). ACCOUNT NUMBER: <<ALLTRIM(cAppointments.ServiceNum)+IIF(EMPTY(cAppointments.CodeWord),""," ("+cAppointments.CodeWord+")")>> CUSTOMER NAME: <<cAppointments.cName>> ADDRESS: <<ALLTRIM(cAppointments.Address1)+IIF(EMPTY(cAppointments.Address2),"",", "+ALLTRIM(cAppointments.Address2))+", "+ALLTRIM(cAppointments.Town)+", "+ALLTRIM(cAppointments.State)+" "+ALLTRIM(cAppointments.Zip)>> PROBLEM REPORT: <<cAppointments.Problem1>> ENDTEXT loAppt.Body=lcBody SELECT Email_Recipients SCAN FOR lActive loPerson = loAppt.Recipients.Add(ALLTRIM(Email_Recipients.cEmailAddr)) loPerson.Type = 1 loPerson.Resolve() ENDSCAN loAppt.Send() loAppt.Save() * Set Unused3 to the date so we know not to grab it again SQLEXEC(lnHandle,"UPDATE AppDet SET Unused3=?lnSentDate WHERE SysID=?cAppointments.SysID") ENDSCAN loFolder = loNameSpace.GetDefaultfolder(4) && Go to Outbox, folder 4 ltSendStartTime=DATETIME() DO WHILE loFolder.Items.Count>0 AND DATETIME()-ltSendStartTime<10 * Force delivery FOR lnIndex=1 TO loNameSpace.SyncObjects.Count loNameSpace.SyncObjects.Item(lnIndex).Start() ENDFOR ENDDO MESSAGEBOX("Appointments have been sent.",0+64,"Appointments sent",60000) * Not sure if we need to do a loOutlook.Quit() here * UPDATE - when testing, Outlook appears to close itself, and Quit() is not necessary ENDIFThe client complains that when we have a single appointment for 11 recipients, the system is trying to send about 409 tasks. Eventually, the user is prompted for the name/password and they have to cancel out of the program. The Outlook is configured to use gmail account.