' 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!

相关文章:

  • 2021-11-29
  • 2021-09-13
  • 2021-06-21
  • 2021-12-13
  • 2022-12-23
  • 2022-02-16
  • 2021-08-21
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-09-29
  • 2021-11-21
  • 2021-10-28
相关资源
相似解决方案