Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Language=VBScript %>
- <%
- Set objConn = Server.CreateObject("ADODB.Connection")
- objConn.provider ="ADsDSOObject"
- objConn.Properties("User ID") = "acc"
- objConn.Properties("Password") = "pass"
- objConn.Properties("Encrypt Password") = True
- objConn.open "Active Directory Provider"
- Set objCom = CreateObject("ADODB.Command")
- Set objCom.ActiveConnection = objConn
- objCom.CommandText ="select sAMAccountName,givenname,sn,extensionAttribute1,ipPhone,mail,telephonenumber,mobile,thumbnailphoto " & _
- " FROM 'LDAP://OU=...DC=net' where " & _
- "userAccountControl=512 AND sAMAccountname='*' AND extensionAttribute1='*' ORDER by extensionAttribute1"
- Set objRS = objCom.Execute(sn)
- res = "["
- Do While Not objRS.EOF Or objRS.BOF
- ph = "false"
- if not isnull(objRS("thumbnailphoto")) then ph = "true"
- if right(res, 1) <> "[" then res = res & ","
- res = res & "{""desk"":""" & objRS("extensionAttribute1") & """, ""user"":""" & objRS("sAMAccountName") & """, ""firstname"":""" & objRS("givenname") & """, " & _
- """surname"":""" & objRS("sn") & """, ""extension"":""" & objRS("ipPhone") & """, ""email"":""" & objRS("mail") & """, ""mobile"":""" & objRS("mobile") & """, ""photo"":" & ph & " }"
- objRS.MoveNext
- Loop
- res = res & "]"
- Response.Write res
- Response.Flush
- objRS.Close
- objConn.Close
- Set objRS = Nothing
- Set objConn = Nothing
- Set objCom = Nothing
- Set objADsPath = Nothing
- Set objDomain = Nothing
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement