PC Review


Reply
Thread Tools Rate Thread

ADSI WinNT:// provider

 
 
Thomaz
Guest
Posts: n/a
 
      7th Jan 2004
In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C#

Set objContainer = GetObject("WinNT://ASIA")
objContainer.Filter = Array("user", "group")
For Each user In objContainer
List1.AddItem user.Name
Next

Thanks and Regards,
Thomaz
 
Reply With Quote
 
 
 
 
Willy Denoyette [MVP]
Guest
Posts: n/a
 
      7th Jan 2004
Check the System.DirectoryServices namespace in MSDN.
http://msdn.microsoft.com/library/de...opytotopic.asp

And start reading "Creating DirectoryEntry Component Instances"
http://msdn.microsoft.com/library/en...asp?frame=true

I would also suggest to drop the WinNT provider in favor of the LDAP
provider when running a AD domain.

Willy.



"Thomaz" <(E-Mail Removed)> wrote in message
news:013701c3d555$76202360$(E-Mail Removed)...
> In VB, I can write the following code to get the list of
> users and groups in the domain ASIA. How do I do the same
> in C#
>
> Set objContainer = GetObject("WinNT://ASIA")
> objContainer.Filter = Array("user", "group")
> For Each user In objContainer
> List1.AddItem user.Name
> Next
>
> Thanks and Regards,
> Thomaz



 
Reply With Quote
 
Arild Bakken
Guest
Posts: n/a
 
      7th Jan 2004
using System.DirectoryServices;

DirectoryEntry objContainer = new DirectoryEntry("WinNT://ASIA");
objContainer.Children.SchemaFilter.Add("group");
objContainer.Children.SchemaFilter.Add("user");
foreach(DirectoryEntry objItem in objContainer.Children) {
List1.AddItem(objItem.Properties["cn"][0].ToString());
}

From the top of my head.


Arild

"Thomaz" <(E-Mail Removed)> wrote in message
news:013701c3d555$76202360$(E-Mail Removed)...
> In VB, I can write the following code to get the list of
> users and groups in the domain ASIA. How do I do the same
> in C#
>
> Set objContainer = GetObject("WinNT://ASIA")
> objContainer.Filter = Array("user", "group")
> For Each user In objContainer
> List1.AddItem user.Name
> Next
>
> Thanks and Regards,
> Thomaz



 
Reply With Quote
 
Danny Lesnik
Guest
Posts: n/a
 
      7th Jan 2004

System.DirectoryServices.DirectoryEntry entryRoot
= new System.DirectoryServices.DirectoryEntry
("WinNT://danny-4649bwcv8", null, null,
AuthenticationTypes.None );
try
{

System.DirectoryServices.DirectoryEntries
userEntries = entryRoot.Children;
foreach
(System.DirectoryServices.DirectoryEntry user in
userEntries)
{
if
(user.SchemaClassName.Equals("User"))

Console.WriteLine(user.Name);
}
}
catch
(System.Runtime.InteropServices.COMException e)
{
Console.WriteLine
( "Error " + e);
}


>-----Original Message-----
>In VB, I can write the following code to get the list of
>users and groups in the domain ASIA. How do I do the same
>in C#
>
> Set objContainer = GetObject("WinNT://ASIA")
> objContainer.Filter = Array("user", "group")
> For Each user In objContainer
> List1.AddItem user.Name
> Next
>
>Thanks and Regards,
>Thomaz
>.
>

 
Reply With Quote
 
=?Utf-8?B?RGFubnkgTGVzbmlr?=
Guest
Posts: n/a
 
      13th Jan 2004
System.DirectoryServices.DirectoryEntry entryRoot
= new System.DirectoryServices.DirectoryEntr
("WinNT://danny-4649bwcv8", null, null,
AuthenticationTypes.None )
tr


System.DirectoryServices.DirectoryEntries
userEntries = entryRoot.Children
foreac
(System.DirectoryServices.DirectoryEntry user in
userEntries

i
(user.SchemaClassName.Equals("User")

Console.WriteLine(user.Name)


catch
(System.Runtime.InteropServices.COMException e
{
Console.WriteLin
( "Error " + e)


>-----Original Message----
>In VB, I can write the following code to get the list of
>users and groups in the domain ASIA. How do I do the same
>in C
>> Set objContainer = GetObject("WinNT://ASIA"

> objContainer.Filter = Array("user", "group"
> For Each user In objContaine
> List1.AddItem user.Nam
> Nex
>>Thanks and Regards

>Thoma
>





Print | Copy URL of this post



.. .


Contact Us | Rules of Conduct
©2004 Microsoft Corporation. All rights reserved. Terms of Use | Privacy Statement

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server or ADSI Provider..? hangar18 Microsoft Windows 2000 Active Directory 0 19th Jun 2006 01:00 PM
System.DirectoryServices and WinNT provider Trevor Lawrence Microsoft Dot NET 0 7th Jun 2006 01:17 AM
USE OF ADO TO ACCESS OBJECT THRU AN ADSI LDAP PROVIDER =?Utf-8?B?U2FuZHJv?= Microsoft Access VBA Modules 3 27th Oct 2005 05:34 PM
WinNT provider, c#, retrieving NT computers =?Utf-8?B?Sm9obiBQ?= Microsoft Dot NET 2 1st Jun 2005 07:21 PM
nativeobject fails with Winnt ADSI connection =?Utf-8?B?SmFzb24=?= Microsoft C# .NET 0 17th Aug 2004 02:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:13 AM.