home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a108 / 6.ddi / SAMPLES / SPLUS / SP_APPT.PRG next >
Encoding:
Text File  |  1993-09-09  |  1.8 KB  |  79 lines

  1. * Test code for Schedule+ Appointment functions.
  2.  
  3. * load the FLL
  4. SET LIBRARY TO foxmapi.fll
  5.  
  6. * start a MAPI session.
  7.  
  8. hmapisession = 0
  9. retval=mplogon(0, "", "", 3, 0, @hmapisession)
  10.  
  11. * create cursors for recipients and restrictions.
  12.  
  13. =mpcursor("MapiRecip", "")
  14. =mpcursor("SPlusRest", "SPlusRestr")
  15.  
  16. * Set initial cursor values.
  17.  
  18. SELECT mapirecip
  19. SET SAFETY OFF
  20. ZAP
  21. SET SAFETY ON
  22. APPEND BLANK
  23.  
  24. REPLACE mapirecip.reserved WITH 0
  25. REPLACE mapirecip.recipclass WITH 0
  26. REPLACE mapirecip.name WITH  ""
  27. REPLACE mapirecip.address WITH  ""
  28. REPLACE mapirecip.eidsize WITH  0
  29. REPLACE mapirecip.entryid WITH  ""
  30.  
  31. * Set restriction cursor to find appointments for today.
  32.  
  33. SELECT splusrestr
  34. SET SAFETY OFF
  35. ZAP
  36. SET SAFETY ON
  37. APPEND BLANK
  38.  
  39. REPLACE splusrestr.reserved WITH 0
  40. REPLACE splusrestr.itemtype WITH "Appt"
  41. REPLACE splusrestr.resttype WITH "Day"
  42. REPLACE splusrestr.restdata WITH ""
  43.  
  44. * Create a SPLUS session.
  45.  
  46. hsession = 0
  47. retval=spbegin(0, 0, 0, 0, @hsession)
  48.  
  49. itemid=SPACE(1)
  50.  
  51. * Find first appointment for restrictions set in SPlusRestr.
  52.  
  53. retval=spfindnext(hsession, 0, "MapiRecip", "SPlusRestr", "", 0, 0, @itemid)
  54. WAIT WINDOW "return from SPFindNext = " + STR(retval)
  55.  
  56. * Read to appointment.
  57.  
  58. retval=spreadappt(hsession, 0, "MapiRecip", itemid, 0, 0, "SPlusAppt", "SPlusAssoc", "SPlusAttd", "MapiAttd")
  59. WAIT WINDOW "return from SPReadAppt = " + STR(retval)
  60.  
  61. IF retval = 0
  62.     * Replace appointment text and save.
  63.  
  64.     SELECT splusappt
  65.     GOTO TOP
  66.     REPLACE splusappt.text WITH "Hello from foxprow"
  67.  
  68.     retval=spsaveappt(hsession, 0, "MapiRecip", "SPlusAppt", "SPlusAssoc", "SPlusAttd", "MapiAttd", 0, 0, @itemid)
  69.     WAIT WINDOW "return from SPSaveAppt = " + STR(retval)
  70. ENDIF
  71.  
  72. * Logoff from SPLUS and MAPI.
  73.  
  74. retval=spend(hsession, 0, 0, 0)
  75. retval=mplogoff(hmapisession, 0, 0, 0)
  76.  
  77. SET LIBRARY TO
  78.  
  79.