Dela via


Deleting Items

Topic Last Modified: 2006-06-12

To delete an item from a folder, use the Record.DeleteRecord method. If you delete a folder item, all items within the folder are also deleted.

Example

VBScript

Example

Dim Rec
Dim Conn
Dim Info
Dim InfoNT
Dim sUrl
Set Info   = CreateObject("ADSystemInfo")
Set InfoNT = CreateObject("WinNTSystemInfo")

sUrl = "http://" & InfoNT.Computername & "." & Info.DomainDNSName & "/public/test_folder2/test1.txt"

Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "ExOLEDB.DataSource"
Conn.Open sUrl

Set Rec = CreateObject("ADODB.Record")

Rec.Open sURL, Conn, adModeReadWrite
Rec.DeleteRecord

' Clean up.
Rec.Close
Conn.Close

Visual Basic

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Library

Dim Rec As New ADODB.Record
Dim Conn as New ADODB.Connection
Dim sUrl as String

sUrl = "https://server/public/test_folder2/test1.txt"

Conn.Provider = "ExOLEDB.DataSource"
Conn.Open sURL

Rec.Open sURL, Conn, adModeReadWrite
Rec.DeleteRecord

' Clean up.
Conn.Close
Rec.Close

Set Conn = Nothing
Set Rec = Nothing