|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: Reading a list of users from XPYes, I believe we are using Active Directory. We have a Windows 2003
server. Show quoteHide quote "BK" <bkunn***@hotmail.com> wrote in message news:1159814834.535305.33030@m7g2000cwm.googlegroups.com... > Are you using Active Directory? > This is crude, but it should get you started. This code will give you
all the users in AD: Console.WriteLine("** Listing Start") Dim oDirectoryEntry As DirectoryServices.DirectoryEntry = New DirectoryEntry("LDAP://SomeDomainHere") Dim oDirectorySearcher As DirectorySearcher = New DirectorySearcher(oDirectoryEntry) oDirectorySearcher.Filter = ("(ObjectClass=User)") Dim oResult As SearchResult = oDirectorySearcher.FindOne For Each oResult In oDirectorySearcher.FindAll Console.WriteLine(oResult.GetDirectoryEntry().Name) Next Console.WriteLine("Listing End **") I copied the code into my project but my DirectoryServices are not defined.
How can I do that? Do I need to import a namespace? If so, which one? I ran through Imports system. and couldn't find DirectoryServices. Any help would be appreciated. Show quoteHide quote "BK" <bkunn***@hotmail.com> wrote in message news:1159893158.440548.155250@i3g2000cwc.googlegroups.com... > This is crude, but it should get you started. This code will give you > all the users in AD: > > Console.WriteLine("** Listing Start") > > Dim oDirectoryEntry As DirectoryServices.DirectoryEntry = New > DirectoryEntry("LDAP://SomeDomainHere") > Dim oDirectorySearcher As DirectorySearcher = New > DirectorySearcher(oDirectoryEntry) > > oDirectorySearcher.Filter = ("(ObjectClass=User)") > Dim oResult As SearchResult = oDirectorySearcher.FindOne > For Each oResult In oDirectorySearcher.FindAll > Console.WriteLine(oResult.GetDirectoryEntry().Name) > Next > > Console.WriteLine("Listing End **") > > I copied the code into my project but my DirectoryServices are not defined. Yep...> How can I do that? Do I need to import a namespace? If so, which one? I > ran through Imports system. and couldn't find DirectoryServices. Imports System.DirectoryServices There is no System.DirectoryServices when I look at intellisense. Is there
something else to import first? VS 2005 VB.NET Show quoteHide quote "BK" <bkunn***@hotmail.com> wrote in message news:1159963025.181238.283280@k70g2000cwa.googlegroups.com... >> I copied the code into my project but my DirectoryServices are not >> defined. >> How can I do that? Do I need to import a namespace? If so, which one? >> I >> ran through Imports system. and couldn't find DirectoryServices. > > Yep... > > Imports System.DirectoryServices > Add a reference to System.DirectoryServices in the My Project thingammybob.
It's not referenced by default. __________________________ The Reaper Show quoteHide quote "Sam Smith" <s**@yada.com> wrote in message news:u690R975GHA.3808@TK2MSFTNGP06.phx.gbl... > There is no System.DirectoryServices when I look at intellisense. Is > there something else to import first? > > VS 2005 VB.NET > > > "BK" <bkunn***@hotmail.com> wrote in message > news:1159963025.181238.283280@k70g2000cwa.googlegroups.com... >>> I copied the code into my project but my DirectoryServices are not >>> defined. >>> How can I do that? Do I need to import a namespace? If so, which one? >>> I >>> ran through Imports system. and couldn't find DirectoryServices. >> >> Yep... >> >> Imports System.DirectoryServices >> > > I added the reference to DirectoryServices into my project and it now works.
Thanks for the tip. Show quoteHide quote "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> wrote in message news:tKGdnVkmVL3zkLnYRVnyrg@bt.com... > Add a reference to System.DirectoryServices in the My Project > thingammybob. > It's not referenced by default. > __________________________ > The Reaper > > "Sam Smith" <s**@yada.com> wrote in message > news:u690R975GHA.3808@TK2MSFTNGP06.phx.gbl... >> There is no System.DirectoryServices when I look at intellisense. Is >> there something else to import first? >> >> VS 2005 VB.NET >> >> >> "BK" <bkunn***@hotmail.com> wrote in message >> news:1159963025.181238.283280@k70g2000cwa.googlegroups.com... >>>> I copied the code into my project but my DirectoryServices are not >>>> defined. >>>> How can I do that? Do I need to import a namespace? If so, which one? >>>> I >>>> ran through Imports system. and couldn't find DirectoryServices. >>> >>> Yep... >>> >>> Imports System.DirectoryServices >>> >> >> > >
MDI Min Max - still there
Q: closing forms CURRENT INDEX of Iteration on ILIST collection ? da.update bool--> yes/no 1.1 equivalent for Drawing.Icon.ExtractAssociatedIcon? Accessing the Class Name of a Shared Method Help with using bits in an integer Writing Custom DLLs in VB.net 2 VS 2005: Forms Designer Clears CancelButton and AcceptButton on Compile Recursive Directory / File Listing With Progress? |
|||||||||||||||||||||||