' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Library
Sub AddAttachmentToAppt(iAppt As CDO.Appointment, strFilePath As String, strContentType As String, strEncoding As String)
Dim iBp As CDO.IBodyPart
Set iBp = iAppt.Attachments.Add
'Set the fields for the attachment
Set Flds = iBp.Fields
Flds.Item("urn:schemas:mailheader:content-type") = strContentType
Flds.Item("urn:schemas:mailheader:content-transfer-encoding") = strEncoding
Flds.Update
'Get the stream interface on the body part
Set Stm = iBp.GetDecodedContentStream
'Load the attachment file into the stream and flush
' the stream to save it back to the body part
Stm.LoadFromFile strFilePath
Stm.Flush
End Sub
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Provider = "ADsDSOObject"
objConn.Open
'create a Global Catalog object and find the Global Catalog path
Set MyGC = GetObject("GC:")
For Each objGC In MyGC
MyPath = objGC.ADsPath
Next
'build the SQL statement to query the ADsPath
strSQL = "SELECT ADsPath FROM '" & MyPath & "' WHERE objectClass='user'"
'open the Recordset
objRS.Open strSQL, objConn
在objRS中有所有User的ADsPath!
浙公网安备 33010602011771号