Active Directory Web Service for Infopath 2003 - InfoPath Dev
in

InfoPath Dev

Active Directory Web Service for Infopath 2003

Last post 07-06-2007 07:21 AM by ahardin. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 04-20-2007 06:08 AM

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Active Directory Web Service for Infopath 2003

    Hi

    Have got the following code from http://www.sharepointu.com/forums/Active_Directory_Web_Service_-_Updated!!!/m_41077/tm.htm and amended it for my own use to render

     

    Service.vb

    Imports System

    System

    Imports System.Data

    System.Data

    Imports System.Web

    System.Web

    Imports System.Web.Services

    System.Web.Services

    Imports System.Web.Services.Protocols

    System.Web.Services.Protocols

    Imports System.Web.UI.Page

    System.Web.UI.Page

    Imports System.Xml

    <WebService(Namespace:="http://afdintranet/ADUserInfo")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    System.Xml

    <WebService(Namespace:="http://afdintranet/ADUserInfo")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    "http://afdintranet/ADUserInfo")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Public Class Service

    <WebMethod()> _

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Class Service

    <WebMethod()> _

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Return objADL.GetAttribute(Attribute)

    End Function

    End Function

    <WebMethod()> _

    Public Function ADUserInfo() As DataSet

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

    'Get information about the user.

    Public Function ADUserInfo() As DataSet

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

    'Get information about the user.

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

    'Get information about the user.

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

    'Get information about the user.

    'Get information about the user.

    objADL.EnumerateSearch("sAMAccountName", usrCurrent) 'Search AD using the Account name of the current user.

    "sAMAccountName", usrCurrent) 'Search AD using the Account name of the current user.

    Dim strGivenName As String = objADL.GetAttribute("givenName")

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strGivenName As String = objADL.GetAttribute("givenName")

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Return dsUser

    End Function

    End Class

    End Function

    End Class

    Class

    AD_Lookup.vb

    Imports Microsoft.VisualBasic

    Microsoft.VisualBasic

    Imports System.DirectoryServices

    System.DirectoryServices

    Imports System.Data

    System.Data

    Public Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    End Function

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    End Sub

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    End Function

    End Class

    Class

    But am a loss to how to publish or whatever the term of phrase is as the Visual Web Developer 2005 Express project is only currently on my hard drive.  I am using the code on the web site within my Form but am unable to get the ?WSDL Infopath needs to run the service.

    Can anyone help?

    Adam

    Imports Microsoft.VisualBasic

    Imports System.DirectoryServices

    System.DirectoryServices

    Imports System.Data

    System.Data

    Public Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    End Function

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    End Sub

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    End Function

    End Class

    Class

    But am a loss to how to publish or whatever the term of phrase is as the Visual Web Developer 2005 Express project is only currently on my hard drive.  I am using the code on the web site within my Form but am unable to get the ?WSDL Infopath needs to run the service.

    Can anyone help?

    Adam

    I'm from WALES
    [email protected]
  • 04-24-2007 01:34 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    OK,

     

    Have the web service running successfully on the local host after installing .NET 2.0 SDK and from the SDK Command Prompt running Disco.exe.

     Question know is how to publsih the web service to an IIS server to roll out this service?

    Here's hoping for some help :-)

     Thanks Adam

    I'm from WALES
    [email protected]
  • 04-25-2007 12:17 AM In reply to

    • chang
    • Not Ranked
    • Joined on 03-29-2007
    • Posts 23

    Re: Active Directory Web Service for Infopath 2003

    You need to create either a virtual directory or web site in IIS and then follow the instructions in this link: http://msdn2.microsoft.com/en-us/library/s9w05e9b(vs.80).aspx

  • 07-04-2007 04:36 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    Now need to convert the whole script into C# before publishing, but have never programmed in C# so too much fun for me.  I have tried converting the code using a web tool but creates errors.  Anyone got any ideas?
    I'm from WALES
    [email protected]
  • 07-04-2007 04:49 AM In reply to

    Re: Active Directory Web Service for Infopath 2003

    Why do you need to convert everything in C# ? If you really need to then I guess you have to get through this by yourself. The best I can suggest is to use the msdn help and search a lot on google. If you have only small code snippets you have problems with I (others) can propably assist you but to translate your complete script into C# would just take to much time. Just had a look again and if you talk about the code you posted in this thread it's not scripting its vb.Net also managed code exactly like C# no need to convert it.
    Listen to Motörhead cos they play Rock'n Roll :)
  • 07-04-2007 07:49 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    Hi

     Reason I need to convert to C# is because of policy statements in the company I am contracting for.  VB is fine for development but ONLY C# for Live Web Services.

    I am sorry but I do not understand your point about vb.Net equalling Managed Code which in turn equals C#.  The second code sample i posted was written in Visual Web Developer 2005 Express as a vb.Net web service, and works a treat.

    The first bit of code is my attempt at working it in to C#.  Could you clarify which bits of code you are talking about and how they could be the same?

    Many thanks, sorry but I am very new to this programming gig and only doing under protest ?!?!?!

    Cheers Adam

    I'm from WALES
    [email protected]
  • 07-05-2007 01:52 AM In reply to

    Re: Active Directory Web Service for Infopath 2003

    Sorry but I think I am a bit confused now. In the code you posted (by the way you have the same problems than I do, everything is duplicated) I can't see any C# code.

    You can write managed on the .net platform with eiterh VB.NET or C#.NET. Could you please clarify one more time what code exactly you need to convert.

    Listen to Motörhead cos they play Rock'n Roll :)
  • 07-05-2007 02:13 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    This the the successful VB code I need to convert into C#

    Service.vb

    Imports System

    System

    Imports System.Data

    System.Data

    Imports System.Web

    System.Web

    Imports System.Web.Services

    System.Web.Services

    Imports System.Web.Services.Protocols

    System.Web.Services.Protocols

    Imports System.Web.UI.Page

    System.Web.UI.Page

    Imports System.Xml

    <WebService(Namespace:="http://afdintranet/ADLookup")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    System.Xml

    <WebService(Namespace:="http://afdintranet/ADLookup")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    "http://afdintranet/ADLookup")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Public Class Service

    <WebMethod()> _

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Class Service

    <WebMethod()> _

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Dim objADL As New AD_Lookup

    objADL.EnumerateSearch(SearchParameter, SearchString)

    Return objADL.GetAttribute(Attribute)

    End Function

    Return objADL.GetAttribute(Attribute)

    End Function

    End Function

    <WebMethod()> _

    Public Function ADUserInfo() As DataSet

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"))

    'Get information about the user.

    Public Function ADUserInfo() As DataSet

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"))

    'Get information about the user.

    Dim objADL As New AD_Lookup

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"))

    'Get information about the user.

    Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"))

    'Get information about the user.

    'Get information about the user.

    objADL.EnumerateSearch("sAMAccountName", usrCurrent) 'Search AD using the Account name of the current user.

    "sAMAccountName", usrCurrent) 'Search AD using the Account name of the current user.

    Dim strGivenName As String = objADL.GetAttribute("givenName")

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strGivenName As String = objADL.GetAttribute("givenName")

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strSN As String = objADL.GetAttribute("sn")

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strTitle As String = objADL.GetAttribute("title")

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strMail As String = objADL.GetAttribute("mail")

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim strDepartment As String = objADL.GetAttribute("department")

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim dsUser As DataSet = New DataSet("AD_Info")

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim dtUserInfo As DataTable = New DataTable("User_Info")

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Dim drAttrib As DataRow = dtUserInfo.NewRow()

    dtUserInfo.Columns.Add("givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "givenName")

    dtUserInfo.Columns.Add("sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "sn")

    dtUserInfo.Columns.Add("title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "title")

    dtUserInfo.Columns.Add("mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "mail")

    dtUserInfo.Columns.Add("manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "manager")

    dtUserInfo.Columns.Add("department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "department")

    dtUserInfo.Columns.Add("description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "description")

    dtUserInfo.Columns.Add("distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "distinguishedName")

    drAttrib("givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "givenName") = strGivenName

    drAttrib("sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "sn") = strSN

    drAttrib("title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "title") = strTitle

    drAttrib("mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "mail") = strMail

    drAttrib("department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    "department") = strDepartment

    dtUserInfo.Rows.Add(drAttrib)

    dsUser.Tables.Add(dtUserInfo)

    Return dsUser

    End Function

    End Class

    Return dsUser

    End Function

    End Class

    End Function

    End Class

    Class

    Imports Microsoft.VisualBasic

    Microsoft.VisualBasic

    Imports System.DirectoryServices

    System.DirectoryServices

    Imports System.Data

    System.Data

    Public Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Class AD_Lookup

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Private m_SearchResult As SearchResult

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Public Function GetAttribute(ByVal Attribute As String) As Object

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    Return m_SearchResult.GetDirectoryEntry().Properties(Attribute).Value

    End Function

    End Function

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Public Sub EnumerateSearch(ByVal SearchParameter As String, ByVal SearchString As String)

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    Dim objDS As New DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")")

    m_SearchResult = objDS.FindOne()

    End Sub

    End Sub

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Public Function Get_sAMAccountName(ByVal strLogonName As String) As String

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    Return strLogonName.Substring(strLogonName.IndexOf("\") + 1)

    End Function

    End Class

    End Function

    End Class

    Class
    I'm from WALES
    [email protected]
  • 07-05-2007 02:22 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    This is my C# conversion that 404's and produces a

    A first chance exception of type 'System.UriFormatException' occurred in System.dll

    using System;

    System;

    using System.Data;

    System.Data;

    using System.Web;

    System.Web;

    using System.Web.Services;

    System.Web.Services;

    using System.Web.Services.Protocols;

    System.Web.Services.Protocols;

    using System.Web.UI;

    System.Web.UI;

    using System.Xml;

    System.Xml;

    using Microsoft.CSharp;

    [WebService(Namespace = "http://afdintranet/ADLookup")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    Microsoft.CSharp;

    [WebService(Namespace = "http://afdintranet/ADLookup")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    WebService(Namespace = "http://afdintranet/ADLookup")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    public class Service

    class Service

    {

    System.Web.HttpRequest Request = new HttpRequest("filename", "url", "query");

    [WebMethod()]

    public void ADQuery(string SearchParameter, string SearchString, string Attribute)

    {

    AD_Lookup objADL = new AD_Lookup();

    objADL.EnumerateSearch(SearchParameter, SearchString);

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    HttpRequest Request = new HttpRequest("filename", "url", "query");

    [WebMethod()]

    public void ADQuery(string SearchParameter, string SearchString, string Attribute)

    {

    AD_Lookup objADL = new AD_Lookup();

    objADL.EnumerateSearch(SearchParameter, SearchString);

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    WebMethod()]

    public void ADQuery(string SearchParameter, string SearchString, string Attribute)

    {

    AD_Lookup objADL = new AD_Lookup();

    objADL.EnumerateSearch(SearchParameter, SearchString);

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    public void ADQuery(string SearchParameter, string SearchString, string Attribute)

    {

    AD_Lookup objADL = new AD_Lookup();

    objADL.EnumerateSearch(SearchParameter, SearchString);

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    AD_Lookup objADL = new AD_Lookup();

    objADL.EnumerateSearch(SearchParameter, SearchString);

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    return ;

    }

    [WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    WebMethod()]

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    public DataSet ADUserInfo()

    {

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    AD_Lookup objADL = new AD_Lookup();

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

    // Get information about the user.

    // Get information about the user.

    objADL.EnumerateSearch("sAMAccountName", usrCurrent);

    // Search AD using the Account name of the current user.

    "sAMAccountName", usrCurrent);

    // Search AD using the Account name of the current user.

    // Search AD using the Account name of the current user.

    string strGivenName = Convert.ToString(objADL.GetAttribute("givenName"));

    string strSN = Convert.ToString(objADL.GetAttribute("sn"));

    string strTitle = Convert.ToString(objADL.GetAttribute("title"));

    string strMail = Convert.ToString(objADL.GetAttribute("mail"));

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    string strGivenName = Convert.ToString(objADL.GetAttribute("givenName"));

    string strSN = Convert.ToString(objADL.GetAttribute("sn"));

    string strTitle = Convert.ToString(objADL.GetAttribute("title"));

    string strMail = Convert.ToString(objADL.GetAttribute("mail"));

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    string strSN = Convert.ToString(objADL.GetAttribute("sn"));

    string strTitle = Convert.ToString(objADL.GetAttribute("title"));

    string strMail = Convert.ToString(objADL.GetAttribute("mail"));

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    string strTitle = Convert.ToString(objADL.GetAttribute("title"));

    string strMail = Convert.ToString(objADL.GetAttribute("mail"));

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    string strMail = Convert.ToString(objADL.GetAttribute("mail"));

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DataSet dsUser = new DataSet("AD_Info");

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DataTable dtUserInfo = new DataTable("User_Info");

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DataRow drAttrib = dtUserInfo.NewRow();

    dtUserInfo.Columns.Add("givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "givenName");

    dtUserInfo.Columns.Add("sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "sn");

    dtUserInfo.Columns.Add("title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "title");

    dtUserInfo.Columns.Add("mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "mail");

    dtUserInfo.Columns.Add("manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "manager");

    dtUserInfo.Columns.Add("department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "department");

    dtUserInfo.Columns.Add("description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "description");

    dtUserInfo.Columns.Add("distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "distinguishedName");

    drAttrib["givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "givenName"] = strGivenName;

    drAttrib["sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "sn"] = strSN;

    drAttrib["title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "title"] = strTitle;

    drAttrib["mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "mail"] = strMail;

    drAttrib["department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    "department"] = strDepartment;

    dtUserInfo.Rows.Add(drAttrib);

    dsUser.Tables.Add(dtUserInfo);

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return dsUser;

    }

    }

    using System.DirectoryServices;

    System.DirectoryServices;

    using System.Data;

    System.Data;

    public class AD_Lookup

    class AD_Lookup

    {

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    private SearchResult m_SearchResult;

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public object GetAttribute(string Attribute)

    {

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return m_SearchResult.GetDirectoryEntry().Properties.Values;

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public void EnumerateSearch(string SearchParameter, string SearchString)

    {

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

    m_SearchResult = objDS.FindOne();

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    public string Get_sAMAccountName(string strLogonName)

    {

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

    }

    }

    I'm from WALES
    [email protected]
  • 07-05-2007 02:28 AM In reply to

    Re: Active Directory Web Service for Infopath 2003

    Oh man as you can the copy and paste messed up your code so that makes it already impossible to read it. Did you debug your code to actaully check where it fails. Set breakpoints into your code and then step through it with pressing F11 ind visual studio
    Listen to Motörhead cos they play Rock'n Roll :)
  • 07-05-2007 02:34 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    If you want to see the unduplicated C# code that i am having trouble with then a link to another forum that doesn't have this problem is below

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1816186&SiteID=1

     

    I'm from WALES
    [email protected]
  • 07-06-2007 07:21 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Active Directory Web Service for Infopath 2003

    Hi

     no problem in debugging it compiles perfectly.  It is just it exceptions out when invoking HTTP Post in IE it 404's but the output from Visual Studio says system.nullreferenceexception

     don't know where to go know, ah well

    I'm from WALES
    [email protected]
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.