How to Use Schedule+ 7.0 OLE Automation in Visual FoxPro

Article translations Article translations
Article ID: 147283 - View products that this article applies to.
This article was previously published under Q147283
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SUMMARY

Within 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 INFORMATION

Schedule+ 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:

  • Create new schedule appointments.
  • Remove scheduled appointments.
  • Read a given schedule.

Code Sample to Create New Schedule Appointments

The 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.logon
ENDIF
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
   ENDIF
ENDFOR

********************************
*     End Of Program           *
********************************
				

Code Sample to Remove Scheduled Appointments

The 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.logon
ENDIF
appt=x.Schedulelogged.appointments
appt.reset
DO WHILE !(appt.isendoftable)
<WWFIXEDTEXT><![CDATA[
   IF (TYPE('appt.item.busytype.value')!='N' OR appt.item.busytype.value=0)
     whichone=appt.item.itemid.value
     appt.deleteitem(whichone)
   ENDIF
   appt.skip
ENDDO
CLEAR ALL

********************************
*     End Of Program           *
********************************
				

Code Sample to Read Scheduled Appointments and Populate a Grid

The 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.logon
ENDIF
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 myarr
ENDDO
fAppt=CreateObject('form')
fAppt.Addobject('Grid1','Grid')
fAppt.width=800
WITH fAppt.Grid1
     .visible=.t.
     .left=50
     .top=20
     .width=650
ENDWITH
GO TOP
fAppt.show

********************************
*     End Of Program           *
********************************
				

REFERENCES

For more information on this, please consult the Schedule+ help file provided with the Exchange Developers Kit or contact the Exchange/Schedule+ product support team.

Properties

Article ID: 147283 - Last Review: February 28, 2014 - Revision: 3.1
APPLIES TO
  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
Keywords: 
kbnosurvey kbarchive kbcode KB147283

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com