How to Use Schedule+ 7.0 OLE Automation in Visual FoxProLast reviewed: February 23, 1996Article ID: Q147283 |
The information in this article applies to:
SUMMARYWithin Visual FoxPro, you can take advantage of the OLE Automation capabilities of Schedule+ 7.0 to read or modify your appointments, contacts, task list, and projects.
MORE INFORMATIONSchedule+ 7.0 doesn't export an OLE Automation Type library as you might be used to. What it does expose is the ability to gain access to table objects within the Schedule+ object. You can navigate these table objects by using exposed Schedule+ 7.0 methods. The Appointment table is one table you might want to examine from inside a Visual FoxPro application. You can use the Schedule+ 7.0 Skip method to maneuver through the table in a manner similar to what you might do with a Visual FoxPro table. And you can use the Schedule+ 7.0 GetRows() method, which is quite similar to a SELECT INTO ARRAY. There are also SetRange and SetRestriction methods that give you filtering capability to specify the records you want to search. The following three code samples show some of the basic functions that can be performed:
Code Sample to Create New Schedule AppointmentsThe following code shows how to use the NEW method to add 100 appointments for 1996. It creates a start and end datetime string for each appointment along with some text that denotes it as a test. ******************************** * Begininig Of Program ********************************* PUBLIC appt,x,count,st,end,what,notes,fAppt x=CreateObject('scheduleplus.application.7') IF !x.loggedon() x.logonENDIF appt=x.Schedulelogged.appointments count=0 appt.reset count=1 y=96 FOR m=1 to 12 FOR d=1 to 28 when=alltrim(str(m))+"/"+alltrim(str(d))+"/"+alltrim(str(y))+; " "+right(ttoc(datetime()),11) when2=alltrim(str(m))+"/"+alltrim(str(d))+"/"+alltrim(str(y))+; " "+right(ttoc(datetime()+3600),11) IF count<100 oappt=appt.new oappt.start=when oappt.end=when2 myval="test appointment: "+alltrim(str(count)) oappt.notes=myval oappt.text=myval oappt.busytype=1 count=count+1 oappt=.NULL. ELSE EXIT ENDIF ENDFOR IF count>100 EXIT ENDIFENDFOR ******************************** * End Of Program *********************************
Code Sample to Remove Scheduled AppointmentsThe following code shows how to use OLE Automation to automate Schedule+ 7.0 to remove all tentative appointments, which are denoted by a BUSYTYPE!=1. It also shows how to use the SKIP and DELETEITEM methods. ******************************** * Begininig Of Program ********************************* CLEAR ALL PUBLIC appt,x,count,st,end,what,notes,fAppt x=CreateObject('scheduleplus.application.7') IF !x.loggedon() x.logonENDIF appt=x.Schedulelogged.appointments appt.reset DO WHILE !(appt.isendoftable) IF (TYPE('appt.item.busytype.value')!='N' OR appt.item.busytype.value=0) whichone=appt.item.itemid.value appt.deleteitem(whichone) ENDIF appt.skipENDDO CLEAR ALL ******************************** * End Of Program *********************************
Code Sample to Read Scheduled Appointments and Populate a GridThe following code shows how to use the GetRows() method to pass through the OLE layer once for each 100 records. This is a large performance increase over using the Skip method to move to each records and grab its attributes. Specifically, the code shows how to use OLE Automation to automate Schedule+ and populate a grid with the appointments. ******************************** * Begininig Of Program ********************************* PUBLIC x,count,st,end,what,notes,fAppt x=CreateObject('scheduleplus.application.7') IF !x.loggedon() x.logonENDIF appt=x.Schedulelogged.appointments appt.reset count=0 dime myarr(100,3) oldval=set('safety') SET SAFETY OFF CREATE TABLE apptlist (Text c(40), Start T(10),End T(10)) SET SAFETY &oldval DO WHILE NOT(appt.isendoftable) myarr=appt.getrows(100, "Text","Start","End") append from array myarrENDDO fAppt=CreateObject('form') fAppt.Addobject('Grid1','Grid') fAppt.width=800 WITH fAppt.Grid1 .visible=.t. .left=50 .top=20 .width=650ENDWITH GO TOP fAppt.show ******************************** * End Of Program *********************************
REFERENCESFor more information on this, please consult the Schedule+ help file provided with the Exchange Developers Kit or contact the Exchange/Schedule+ product support team.
|
Additional reference words: 3.00 3.00b VFoxWin splus
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |