Click here to Skip to main content
15,846,899 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: splitting in VB.NET without delimiters Pin
Pete O'Hanlon14-May-09 0:24
subeditorPete O'Hanlon14-May-09 0:24 
GeneralRe: splitting in VB.NET without delimiters Pin
Luc Pattyn14-May-09 2:33
sitebuilderLuc Pattyn14-May-09 2:33 
AnswerRe: splitting in VB.NET without delimiters Pin
Fernando Soto14-May-09 9:28
Fernando Soto14-May-09 9:28 
QuestionDisable "Print" & "Save As" Options From Moss 2007 document Library Pin
Kronfolitto13-May-09 23:12
Kronfolitto13-May-09 23:12 
QuestionLink error with C++ code with Intel fortran code. Pin
lavate malllik13-May-09 22:47
lavate malllik13-May-09 22:47 
QuestionBootstrapper Pin
netDeveloper13-May-09 22:45
netDeveloper13-May-09 22:45 
AnswerRe: Bootstrapper Pin
netDeveloper13-May-09 23:50
netDeveloper13-May-09 23:50 
GeneralRe: Bootstrapper Pin
netDeveloper14-May-09 2:51
netDeveloper14-May-09 2:51 
QuestionWindows address book Pin
ashish purwar13-May-09 20:57
ashish purwar13-May-09 20:57 
QuestionDelete Record from Data Grid Pin
saif_saifi12-May-09 22:50
professionalsaif_saifi12-May-09 22:50 
Questionhow to paint the MainMenu Pin
coderormnger12-May-09 22:21
coderormnger12-May-09 22:21 
AnswerRe: how to paint the MainMenu Pin
Pete O'Hanlon12-May-09 23:08
subeditorPete O'Hanlon12-May-09 23:08 
QuestionHow to get machine certificate and user license. Pin
deadlyabbas12-May-09 22:01
deadlyabbas12-May-09 22:01 
Question.Net Remoting with COM client Pin
lee2312-May-09 20:43
lee2312-May-09 20:43 
Questionproblem with richedit control [modified] Pin
ramaluciano12-May-09 19:52
ramaluciano12-May-09 19:52 
QuestionIRunningObjectTable.Register method Pin
lee2312-May-09 19:23
lee2312-May-09 19:23 
AnswerRe: IRunningObjectTable.Register method Pin
lee2312-May-09 20:06
lee2312-May-09 20:06 
GeneralRe: IRunningObjectTable.Register method Pin
lee2313-May-09 21:25
lee2313-May-09 21:25 
QuestionSeeking advice for storing data in memory [modified] Pin
glumlord12-May-09 8:46
glumlord12-May-09 8:46 
AnswerRe: Seeking advice for storing data in memory Pin
glumlord12-May-09 8:59
glumlord12-May-09 8:59 
Imports System.IO
Imports System.DirectoryServices
Imports System.Data


Module Module1

    Public dsCSIDir As New DataSet("CSIDIR")
    Public Users_Table As New DataTable
    Public drUser As DataRow

    Sub ImportUsers()
        Dim direntry As New DirectoryEntry("LDAP://OU=CSI Users, DC=csileasing, DC=com")
        Dim searcher As New DirectorySearcher(direntry)

        Dim i As Integer = 0
        Dim result As SearchResult
        Console.WriteLine("Started Data Import at :  " & TimeOfDay)
        Try
            searcher.Filter = "(&(objectClass=user)(samaccountname=*))"
            searcher.ClientTimeout = TimeSpan.FromSeconds(5)

            For Each result In searcher.FindAll
                If result.Properties("samaccountname")(0) = Nothing Then
                    Continue For
                End If

                drUser = Users_Table.NewRow

                drUser("index") = i

                If result.Properties.Contains("company") Then
                    drUser("Company") = result.GetDirectoryEntry.Properties("company").Value
                Else
                    Continue For
                End If

                drUser("LoginID") = result.GetDirectoryEntry.Properties("samaccountname").Value
                drUser("DisplayName") = result.GetDirectoryEntry.Properties("cn").Value

                If result.Properties.Contains("title") Then
                    drUser("Title") = result.GetDirectoryEntry.Properties("title").Value
                End If

                If result.Properties.Contains("telephoneNumber") Then
                    drUser("OfficePhone") = result.GetDirectoryEntry.Properties("telephoneNumber").Value
                End If

                If result.Properties.Contains("mobile") Then
                    drUser("CellPhone") = result.GetDirectoryEntry.Properties("mobile").Value
                End If

                If result.Properties.Contains("mail") Then
                    drUser("Email") = result.GetDirectoryEntry.Properties("mail").Value
                End If

                If result.Properties.Contains("streetAddress") Then
                    drUser("Street") = result.GetDirectoryEntry.Properties("streetAddress").Value
                End If

                If result.Properties.Contains("l") Then
                    drUser("City") = result.GetDirectoryEntry.Properties("l").Value
                End If

                If result.Properties.Contains("st") Then
                    drUser("State") = result.GetDirectoryEntry.Properties("st").Value
                End If

                If result.Properties.Contains("postalCode") Then
                    drUser("PostalCode") = result.GetDirectoryEntry.Properties("postalCode").Value
                End If

                If result.Properties.Contains("memberof") Then
                    Dim groups As DirectoryServices.ResultPropertyValueCollection = result.Properties.Item("MemberOf")
                    Dim groupslist As String = ""
                    Dim groupname As String = ""
                    For k As Int16 = 0 To groups.Count - 1
                        Dim fullname As String = result.Properties("memberof").Item(k).ToString
                        groupname = Left(Split(fullname, "=")(1), Len(Split(fullname, "=")(1)) - 3)
                        groupslist = groupslist & groupname & ","
                    Next
                    groupslist = Left(groupslist, Len(groupslist) - 1)
                    drUser("Groups") = groupslist
                End If

                If result.Properties.Contains("manager") Then
                    Dim managername As String() = Split(result.Properties("manager")(0), ",")
                    drUser("Manager") = Right(managername(0), Len(managername(0)) - 3)
                End If

                If result.Properties.Contains("sn") Then
                    drUser("FirstName") = result.GetDirectoryEntry.Properties("sn").Value
                End If

                If result.Properties.Contains("givenname") Then
                    drUser("LastName") = result.GetDirectoryEntry.Properties("givenname").Value
                End If

                If result.Properties.Contains("directReports") Then
                    Dim groups As DirectoryServices.ResultPropertyValueCollection = result.Properties.Item("directReports")
                    Dim groupslist As String = ""
                    Dim groupname As String = ""
                    For k As Int16 = 0 To groups.Count - 1
                        Dim fullname As String = result.Properties("directReports").Item(k).ToString
                        groupname = Left(Split(fullname, "=")(1), Len(Split(fullname, "=")(1)) - 3)
                        groupslist = groupslist & groupname & ","
                    Next
                    groupslist = Left(groupslist, Len(groupslist) - 1)
                    drUser("DirectReports") = groupslist
                End If

                If result.Properties.Contains("department") Then
                    drUser("Department") = result.GetDirectoryEntry.Properties("department").Value
                End If
                i += 1
                Users_Table.Rows.Add(drUser)
            Next
        Catch ex As Exception

        End Try
        Users_Table.AcceptChanges()
        dsCSIDir.Tables.Add(Users_Table)
    End Sub

    Public Sub CreateDataStructure()
        Users_Table.TableName = "Users"
        Console.WriteLine("Start of Create Columns at:  " & TimeOfDay)
        Users_Table.Columns.Add("index", GetType(Integer))
        Users_Table.Columns.Add("LoginID", GetType(String))
        Users_Table.Columns.Add("FirstName", GetType(String))
        Users_Table.Columns.Add("LastName", GetType(String))
        Users_Table.Columns.Add("DisplayName", GetType(String))
        Users_Table.Columns.Add("Title", GetType(String))
        Users_Table.Columns.Add("Company", GetType(String))
        Users_Table.Columns.Add("Email", GetType(String))
        Users_Table.Columns.Add("OfficePhone", GetType(String))
        Users_Table.Columns.Add("CellPhone", GetType(String))
        Users_Table.Columns.Add("Street", GetType(String))
        Users_Table.Columns.Add("City", GetType(String))
        Users_Table.Columns.Add("State", GetType(String))
        Users_Table.Columns.Add("PostalCode", GetType(String))
        Users_Table.Columns.Add("Manager", GetType(String))
        Users_Table.Columns.Add("Department", GetType(String))
        Users_Table.Columns.Add("Groups", GetType(String))
        Users_Table.Columns.Add("DirectReports", GetType(String))
        Console.WriteLine("End of Create Columns at:  " & TimeOfDay)
    End Sub

AnswerRe: Seeking advice for storing data in memory Pin
Ian McCaul12-May-09 9:32
Ian McCaul12-May-09 9:32 
GeneralRe: Seeking advice for storing data in memory Pin
glumlord12-May-09 9:37
glumlord12-May-09 9:37 
GeneralRe: Seeking advice for storing data in memory Pin
Ian McCaul12-May-09 9:43
Ian McCaul12-May-09 9:43 
GeneralRe: Seeking advice for storing data in memory Pin
glumlord12-May-09 10:26
glumlord12-May-09 10:26 
GeneralRe: Seeking advice for storing data in memory Pin
jarbo3a12-May-09 21:13
jarbo3a12-May-09 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.