Hi
I want to convert my Vb.net code to VB6.0
I am seaching for the code to update the active directory , but not able to find in Vb 6.0
can u please tell me any ay to convert that code into vb6.0
Public Interface test
Public Interface test
Sub GetActiveDiretoryInformation()
Sub SingleSynchronization(ByVal strCDGUID As String)
End Interface
Public Class CD2AD
Inherits BusinessComponent
Implements test
Public Sub New()
End Sub
' static string strConnectionString = GenericConfiguration.CompanyDirectoryDatabaseConne ctionString;
Private Shared strConnectionString As String ="server=WSINTRA13;uid=InSite.user;pwd=insiteslc1; database=SLCCorpDir"
Private Shared strADGUID As String = String.Empty
Public Sub GetActiveDiretoryInformation() Implements test.GetActiveDiretoryInformation
Dim domainRoot As String = "LDAP://DC=app,DC=hbi,DC=net"
'string domainRoot = GenericConfiguration.ADLocationPrefix;
'string strUser = GenericConfiguration.AdUsername;
'string strPassword = GenericConfiguration.AdPassword;
Dim strUser As String = "username"
Dim strPassword As String="pwd"
Dim search As New DirectorySearcher(New DirectoryEntry(domainRoot, strUser, strPassword, AuthenticationTypes.Secure))
Dim adUserGuid As Guid
'<GUID=" + adUserGuid + ">
'search.Filter = String.Format(CultureInfo.InvariantCulture, "(&(GUID={0})(objectClass=person))", "051f42eb120afd4e97d7671e292b1ebd");
search.Filter = String.Format(CultureInfo.InvariantCulture, "(&(cn={0})(objectClass=person))","ccc.ddd")
search.SearchScope = SearchScope.Subtree
'SearchResult result = search.FindAll();
Dim result As SearchResult = search.FindOne()
If Not result Is Nothing Then
Dim userFound As DirectoryEntry = result.GetDirectoryEntry()
adUserGuid = New Guid(userFound.NativeGuid)
Console.WriteLine("Current title : " & userFound.Properties("mail")(0).ToString())
'Console.WriteLine("Current Company : " +userFound.Properties["company"][0].ToString());
userFound.Properties("mail").Value = "xxx.yyy@xyz.com"
'userFound.Properties["company"].Value="ggg";
userFound.CommitChanges()
End If
End Sub
Public Sub SingleSynchronization(ByVal strCDGUID As String) Implements test.SingleSynchronization
Dim connection As New SqlConnection(strConnectionString)
Dim strQuery As String = "select * from person where ID=" & "'" & strCDGUID & "'"
Try
connection.Open()
Dim da As New SqlDataAdapter(strQuery, connection)
Dim ds As New DataSet()
da.Fill(ds, "person")
Dim dt As DataTable = ds.Tables("person")
For Each row As DataRow In dt.Rows
For Each col As DataColumn In dt.Columns
Console.WriteLine(row(col))
Next col
Next row
GetActiveDiretoryInformation()
Catch e As Exception
Console.WriteLine("Error: " & e)
Finally
connection.Close()
End Try
End Sub
<STAThread> _
Shared Sub Main(ByVal args() As String)
Dim test1 As New CD2AD()
test1.GetActiveDiretoryInformation()
test1.SingleSynchronization("bd1b2ce5f9bb9546b032a af0008dc9ea")
End Sub
End Class
End Namespace