Advertisement
Advertisement
| 02.21.2008 at 12:17PM PST, ID: 23182463 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: |
Dim deuser As DirectoryEntry
Dim dsuser As DirectorySearcher
Dim srusers As SearchResultCollection
Try
'create table to sort by lastname, firstname
Dim tbSearchResults As New DataTable
tbSearchResults.Columns.Add(New DataColumn("Employee"))
tbSearchResults.Columns.Add(New DataColumn("Extension"))
tbSearchResults.Columns.Add(New DataColumn("DirectDial"))
tbSearchResults.Columns.Add(New DataColumn("Mobile"))
tbSearchResults.Columns.Add(New DataColumn("Location"))
'for AD search
deuser = New DirectoryEntry("ldap://server.domain.com", "username", "password")
dsuser = New DirectorySearcher("ldap://ADserver")
dsuser.Filter = GetFilterString()
dsuser.Sort.PropertyName = "sn"
srusers = dsuser.FindAll
If srusers Is Nothing Then
Else
'loop through users in search results
For Each sruser As SearchResult In srusers
'assign names to variables
Dim fname As String = sruser.Properties("givenname").Item(0)
Dim lname As String = sruser.Properties("sn").Item(0)
Dim telephoneNumber As String = ""
If Not sruser.Properties("telephoneNumber") Is Nothing Then telephoneNumber = sruser.Properties("telephoneNumber").Item(0)
Dim IPphone As String = ""
If Not sruser.Properties("IPphone") Is Nothing Then IPphone = sruser.Properties("IPphone").Item(0)
Dim Mobile As String = ""
If Not sruser.Properties("Mobile") Is Nothing Then Mobile = sruser.Properties("Mobile").Item(0)
Dim Location As String = ""
If Not sruser.Properties("Physicaldeliveryofficename") Is Nothing Then Location = sruser.Properties("Physicaldeliveryofficename").Item(0)
Dim MidInitial As String = ""
If Not sruser.Properties("initials") Is Nothing Then MidInitial = CType(sruser.Properties("initials").Item(0), String).Substring(0, 1)
Dim AdsPath As String
AdsPath = sruser.Properties("AdsPath").Item(0)
'Exclude if in Termed Employees
If AdsPath.IndexOf("OU=Termed Employees") = -1 Then
'add a row to the Search Results with the AD info for the user
Dim drRow(4) As String
drRow(0) = lname + ", " + fname + " " + MidInitial
drRow(1) = telephoneNumber
drRow(2) = IPphone
drRow(3) = Mobile
drRow(4) = Location
tbSearchResults.Rows.Add(drRow)
End If
Next
'sort it
Dim dvSearchResults As DataView = tbSearchResults.DefaultView
dvSearchResults.Sort = "Employee"
'only print if data is present
If dvSearchResults.Count > 0 Then
DGrid.DataSource = tbSearchResults
DGrid.Refresh()
End If
End If
Catch ex As Exception
Dim sError As String = ex.Message.ToString
Label1.Text = sError
Finally
'clean up
If Not deuser Is Nothing Then deuser.Close()
If Not deuser Is Nothing Then deuser.Dispose()
If Not dsuser Is Nothing Then dsuser.Dispose()
If Not srusers Is Nothing Then srusers.Dispose()
End Try
End Sub
|