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

  1. * Test code for Schedule+ Task functions.
  2.  
  3. * load the FLL.
  4.  
  5. SET LIBRARY TO foxmapi.fll
  6.  
  7. * start a MAPI session.
  8.  
  9. hmapisession = 0
  10. retval=mplogon(0, "", "", 3, 0, @hmapisession)
  11.  
  12. * create cursors for recipients and tasks.
  13.  
  14. =mpcursor("MapiRecip", "")
  15. =mpcursor("SPlusRest", "")
  16.  
  17. * clear reciepient cursor and set initial values.
  18.  
  19. SELECT mapirecip
  20. SET SAFETY OFF
  21. ZAP
  22. SET SAFETY ON
  23. APPEND BLANK
  24. REPLACE reserved WITH 0
  25. REPLACE recipclass WITH 0
  26. REPLACE name WITH  ""
  27. REPLACE address WITH  ""
  28. REPLACE eidsize WITH  0
  29. REPLACE entryid WITH  ""
  30.  
  31. * clear recipient cursor and set initial values
  32. * note this cursor is setup to hold all tasks for the current date
  33. * because restdata is filled with a blank string.
  34.  
  35. SELECT splusrest
  36. SET SAFETY OFF
  37. ZAP
  38. SET SAFETY ON
  39. APPEND BLANK
  40. REPLACE reserved WITH  0
  41. REPLACE itemtype WITH  "Task"
  42. REPLACE resttype WITH  "All"
  43. REPLACE restdata WITH  ""
  44.  
  45. * start a SPLUS session.
  46.  
  47. hsession = 0
  48. retval=spbegin(0, 0, 0, 0, @hsession)
  49.  
  50. * get the first task from the users schedule.
  51.  
  52. lpszitemid=SPACE(1)
  53. retval=spfindnext(hsession, 0, "MapiRecip", "SPlusRest", "", 0, 0, @lpszitemid)
  54. WAIT WINDOW "return from SPFindNext = " + STR(retval)
  55.  
  56. * Read task into cursors.
  57.  
  58. retval=spreadtask(hsession, 0, "MapiRecip", lpszitemid, 0, 0, "SPlusTask", "SPlusAssoc", "", "")
  59. WAIT WINDOW "return from SPReadTask = " + STR(retval)
  60.  
  61. * Replace some field values to test save function.
  62.  
  63. SELECT splustask
  64. GOTO TOP
  65. REPLACE TEXT WITH "Text = Hello from foxprow"
  66. REPLACE projctname WITH "ProjectName = Hello from foxprow"
  67. REPLACE priority WITH "9"
  68.  
  69. * Set itemid to blank - this will cause SPSaveTask to create a new task 
  70. * rather than update task that was read above.
  71.  
  72. lpszitemid = ""
  73.  
  74. * Create new task.
  75.  
  76. retval=spsavetask(hsession, 0, "MapiRecip", "SPlusTask", "SPlusAssoc", "", "", 0, 0, @lpszitemid)
  77. WAIT WINDOW "return from SPSaveTask = " + STR(retval) + " TaskID = " + lpszitemid
  78.  
  79. * Logoff from SPLUS and MAPI.
  80.  
  81. retval=spend(hsession, 0, 0, 0)
  82. retval=mplogoff(hmapisession, 0, 0, 0)
  83.  
  84. SET LIBRARY TO
  85.  
  86.