home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / CHIPCD_3_98.iso / software / testsoft / exchange / webdata / usa / lib / delete.inc < prev    next >
Text File  |  1997-08-25  |  3KB  |  111 lines

  1. <%
  2. '!--Microsoft Outlook Web Access-->
  3. '!--delete.inc - functions for deleting objects -->
  4. '!--Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
  5. '==CONTENTS=======================
  6. ' DeleteItem
  7. ' DeleteItemByID
  8. ' DeleteItems
  9. '=============================
  10.  
  11. '=============================
  12. 'DeleteItem
  13. '=============================
  14. Sub DeleteItem(obj)
  15.     Dim objMoveObj
  16.     Dim bIsAuthenticated
  17.     Dim strDeletedItemsID
  18.     Dim strPublicStoreID
  19.     
  20.     If (Not obj Is Nothing) Then
  21.  
  22.         bIsAuthenticated = Session(bstrAuthenticated)
  23.  
  24.         'Check to make sure user is authenticated. If not authenticated then delete the object.
  25.         If bIsAuthenticated then
  26.             'Get the deleted items entry id from the session.
  27.             strDeletedItemsID = Session(bstrDeletedItemsID)
  28.             strPublicStoreID = Session(bstrPublicStoreEntryID)
  29.             
  30.             'If the object is not in the public store or in the Deleted items folder then 
  31.             'the object is moved to the deleted items folder.
  32.             If obj.StoreID <> strPublicStoreID and obj.FolderID <> strDeletedItemsID then
  33.                 Set objMoveObj = obj.MoveTo(strDeletedItemsID)
  34.                 If (Err.Number <> 0) Or (objMoveObj Is Nothing) Then
  35.                     ReportError1 L_errFailDeleteMessage_ErrorMessage
  36.     
  37.                 Else
  38.                     Set objMoveObj = Nothing
  39.                 End If
  40.             Else
  41.                 'The object is deleted if it is already in the deleted items folder
  42.                 obj.Delete
  43.                 If (Err.Number <> 0) Then
  44.                     ReportError1 L_errFailDeleteMessage_ErrorMessage
  45.                 End If
  46.             End If
  47.         Else
  48.             obj.Delete
  49.             If (Err.Number <> 0) Then
  50.                 ReportError1 L_errFailDeleteMessage_ErrorMessage
  51.             End If
  52.         End If
  53.  
  54.     End If
  55.     
  56.     Set obj = Nothing
  57. End Sub
  58.  
  59. '=======================
  60. ' DeleteItemByID
  61. '
  62. ' szObj - EntryID for Object
  63. ' bIsFolder - Default is false.  If it is a folder then pass in True.
  64. ' Deletes items in private or public store. Items are actually moved to deleted items
  65. ' folder if they are in the private store.
  66. ' Dependencies: The session objects must be instantiated before calling this sub.
  67. '=======================
  68.  
  69. Sub DeleteItemByID(szObj, bIsFolder)
  70.     Dim obj
  71.     
  72.     If bIsFolder then
  73.         Set obj = OpenFolder(szObj)
  74.     Else
  75.         Set obj = OpenMessage(szObj)
  76.     End If
  77.  
  78.     If (obj Is Nothing) Then
  79.         ReportError1 L_errFailDeleteAccess_ErrorMessage
  80.     Else
  81.         DeleteItem obj
  82.     End If
  83.  
  84. End Sub
  85.  
  86. '=======================
  87. ' DeleteItems
  88. '
  89. ' Delete list of items
  90. '=======================
  91.  
  92. Public Sub DeleteItems
  93.  
  94.     For Each szElement In Request.Form
  95.         If IsNumeric(szElement) Then
  96.             szEntryID = Request.Form(szElement)
  97.  
  98.             Set objMessage = OpenMessage(szEntryID)
  99.         If (objMessage Is Nothing) Then
  100.                 ReportError1 L_errFailDeleteAccess_ErrorMessage
  101.             Else
  102.                 DeleteItem objMessage
  103.                 Set objMessage = Nothing
  104.             End If
  105.         End If
  106.     Next
  107.  
  108. End Sub
  109.  
  110.  
  111. %>