ZernanToledo
Programmer
In the intranet system I'm building I need to draw information about Staff and integrate it into Department pages, and also make it accessible via querystrings (so users can search for names). I've asked my IT department how to do this and they basically said "ask the internet"
To summarise I need to :
A) draw names, phone numbers, email addresses to show on relevant department pages. (the code examples pertain to this)
B) Make a facility to search staff names to bring up similar information.
I've had limited success using two different methods, but both have drawbacks. Using ADSI I can get username, description and email info, however cannot seen to find a way to access phone & fax information. The code is:
I know you can access this info using LDAP, however my experiments with this have been less sucessful. I can access the info, but have no idea how to filter it via Group (i.e. department).
I've scoured google and many forums trying to find a solution using either method, but with no luck. Info is usually to obtuse or over my head to make sense. I think you guys may be my last hope.
Any help is much appreciated!
To summarise I need to :
A) draw names, phone numbers, email addresses to show on relevant department pages. (the code examples pertain to this)
B) Make a facility to search staff names to bring up similar information.
I've had limited success using two different methods, but both have drawbacks. Using ADSI I can get username, description and email info, however cannot seen to find a way to access phone & fax information. The code is:
Code:
Set Group = GetObject("WinNT://" & sDomainName & "/" & sGroupName)
For Each Member in Group.Members
If Member.Class = "User" Then
oFullName = Member.FullName
[COLOR=red]oPhone = ????[/color]
oMailStart = Member.Name
IF oFullName = "" THEN
oFullName = "<div class=""Capital"">" & Replace(oMailStart, ".", " ") & "</div>"
ELSE
oFullName = oFullName
END IF
IF oPhone = "" THEN
oPhone = "N/A"
ELSE
oPhone = oPhone
END IF
IF oMailStart = "" THEN
oMailStart = "<td>N/A</td>"
ELSE
oMailStart = "<td><a href=""mailto:" & oMailStart & "@mydomain.com"">" & oMailStart & "@mydomain.com</td>"
END IF
End If
I know you can access this info using LDAP, however my experiments with this have been less sucessful. I can access the info, but have no idea how to filter it via Group (i.e. department).
Code:
Set oRootDSE = GetObject("LDAP://RootDSE")
sDomainADsPath = "LDAP://" & oRootDSE.Get("defaultNamingContext")
Set oRootDSE = Nothing
SQLStmt = "SELECT cn " & _
"FROM '" & sDomainADsPath & "' " & _
"WHERE objectClass='*'"
Set oCon = Server.CreateObject("ADODB.Connection")
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider"
Set rs = oCon.Execute(SQLStmt)
Do While Not rs.EOF Or rs.BOF
ReturnValue = rs.Fields(0)
If IsArray(ReturnValue) Then
For I = LBound(ReturnValue) To UBound(ReturnValue)
If ReturnValue(I) <> "" Then
Response.Write ReturnValue(I) & "<BR>"
End If
Next
Else
Response.Write ReturnValue & "<BR>"
End If
rs.MoveNext
Loop
I've scoured google and many forums trying to find a solution using either method, but with no luck. Info is usually to obtuse or over my head to make sense. I think you guys may be my last hope.
Any help is much appreciated!