Hello,
I'm trying to retrieve the user's properties from Active Directory. I
was able to retrieve all the user properties, however, I wassnt able
to get the manager's user name. What I got was the path of the user
name : CN="Display Name", CN=myCompany,CN =COM..
Here is the
private string[] FindProps(Strin g userAccount)
{
DirectoryEntry entry = new
DirectoryEntry( "LDAP://mypc.mydomain.c om");
String account = userAccount.Rep lace(@"mydomain \", "");
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(SAMAccountNam e=" + account + ")";
search.Properti esToLoad.Add("d isplayName");
search.Properti esToLoad.Add("m ail");
search.Properti esToLoad.Add("d epartment");
search.Properti esToLoad.Add("t itle");
search.Properti esToLoad.Add("m anager");
SearchResult result = search.FindOne( );
string[] props = new string[10];
props[0] = result.Properti es["displaynam e"][0].ToString();
props[1] = result.Properti es["mail"][0].ToString();
props[2] = result.Properti es["department "][0].ToString();
props[3] = result.Properti es["manager"][0].ToString();
props[4] = result.Properti es["title"][0].ToString();
return props;
} function i used to retrieve all the user props. 8 14199
"Mr. Bean" <mk*****@gmail. com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
| Hello,
|
| I'm trying to retrieve the user's properties from Active Directory. I
| was able to retrieve all the user properties, however, I wassnt able
| to get the manager's user name. What I got was the path of the user
| name : CN="Display Name", CN=myCompany,CN =COM..
|
| Here is the
|
| private string[] FindProps(Strin g userAccount)
| {
| DirectoryEntry entry = new
| DirectoryEntry( "LDAP://mypc.mydomain.c om");
| String account = userAccount.Rep lace(@"mydomain \", "");
| DirectorySearch er search = new DirectorySearch er(entry);
| search.Filter = "(SAMAccountNam e=" + account + ")";
| search.Properti esToLoad.Add("d isplayName");
| search.Properti esToLoad.Add("m ail");
| search.Properti esToLoad.Add("d epartment");
| search.Properti esToLoad.Add("t itle");
| search.Properti esToLoad.Add("m anager");
| SearchResult result = search.FindOne( );
| string[] props = new string[10];
| props[0] = result.Properti es["displaynam e"][0].ToString();
| props[1] = result.Properti es["mail"][0].ToString();
| props[2] = result.Properti es["department "][0].ToString();
| props[3] = result.Properti es["manager"][0].ToString();
| props[4] = result.Properti es["title"][0].ToString();
| return props;
| } function i used to retrieve all the user props.
|
This is normal, the Manager attribute is an Object(DS-DN) type attribute
that refers to the manager's user object. If you want the details of this
object you need to query it's properties.
I would suggest you to check the "Active Directory Schema" in the docs
before you start coding against the AD, it's fundamental that you understand
the formal definitions of the attributes of the objects you want to
retrieve.
Willy.
>I'm trying to retrieve the user's properties from Active Directory. I was able to retrieve all the user properties, however, I wassnt able to get the manager's user name. What I got was the path of the user name : CN="Display Name", CN=myCompany,CN =COM..
Yes, that's the way it was designed. If you need details for the
manager, you will now need to grab his DN (distinguishedN ame), bind to
it, and retrieve that user's properties.
Marc
Mr. Bean,
Here might help: http://www.microsoft.com/technet/scr...r/hubs/ad.mspx
chanmm
"Mr. Bean" <mk*****@gmail. com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. . Hello,
I'm trying to retrieve the user's properties from Active Directory. I was able to retrieve all the user properties, however, I wassnt able to get the manager's user name. What I got was the path of the user name : CN="Display Name", CN=myCompany,CN =COM..
Here is the
private string[] FindProps(Strin g userAccount) { DirectoryEntry entry = new DirectoryEntry( "LDAP://mypc.mydomain.c om"); String account = userAccount.Rep lace(@"mydomain \", ""); DirectorySearch er search = new DirectorySearch er(entry); search.Filter = "(SAMAccountNam e=" + account + ")"; search.Properti esToLoad.Add("d isplayName"); search.Properti esToLoad.Add("m ail"); search.Properti esToLoad.Add("d epartment"); search.Properti esToLoad.Add("t itle"); search.Properti esToLoad.Add("m anager"); SearchResult result = search.FindOne( ); string[] props = new string[10]; props[0] = result.Properti es["displaynam e"][0].ToString(); props[1] = result.Properti es["mail"][0].ToString(); props[2] = result.Properti es["department "][0].ToString(); props[3] = result.Properti es["manager"][0].ToString(); props[4] = result.Properti es["title"][0].ToString(); return props; } function i used to retrieve all the user props.
Mr. Bean wrote: Hello,
I'm trying to retrieve the user's properties from Active Directory. I was able to retrieve all the user properties, however, I wassnt able to get the manager's user name. What I got was the path of the user name : CN="Display Name", CN=myCompany,CN =COM..
Here is the
private string[] FindProps(Strin g userAccount) { DirectoryEntry entry = new DirectoryEntry( "LDAP://mypc.mydomain.c om"); String account = userAccount.Rep lace(@"mydomain \", ""); DirectorySearch er search = new DirectorySearch er(entry); search.Filter = "(SAMAccountNam e=" + account + ")"; search.Properti esToLoad.Add("d isplayName"); search.Properti esToLoad.Add("m ail"); search.Properti esToLoad.Add("d epartment"); search.Properti esToLoad.Add("t itle"); search.Properti esToLoad.Add("m anager"); SearchResult result = search.FindOne( ); string[] props = new string[10]; props[0] = result.Properti es["displaynam e"][0].ToString(); props[1] = result.Properti es["mail"][0].ToString(); props[2] = result.Properti es["department "][0].ToString(); props[3] = result.Properti es["manager"][0].ToString(); props[4] = result.Properti es["title"][0].ToString(); return props; } function i used to retrieve all the user props.
I attached an example of something I threw together to do a quick search
of AD.
Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol
thanks for your posts, I will review the code sample attached by JimD..
COuld some one please tell me the exact function to use inorder to
retrieve the user name of the manager. ie what I need is to be able to
retrieve the user's manager in this form: domain\user.
Please include code sample
"Mr. Bean" <mk*****@gmail. com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. . COuld some one please tell me the exact function to use inorder to retrieve the user name of the manager. ie what I need is to be able to retrieve the user's manager in this form: domain\user.
Please include code sample
You've already received an explanation as to how to do this...
I didnt figure out how to confiugure the code knowing that I read the
previous posts This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jay Chan |
last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that
has Windows-2003 Server on it. Now, we cannot get access to that
database server from other computers. Seem like this may be an issue
with Active Directory.
Our network consists of Windows-2000 Servers (SP 4) and Windows-2000
workstations and Windows-XP workstations. We also have SQL Server 2000
(SP2) in three Windows-2000 servers. All work fine. Recently, we get a...
|
by: microsoft |
last post by:
Hi People, when I try to modify an active directory user programatically, I
receive the following exception:
The server is unwilling to process the request
Reading the microsoft web site, I found this article:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;248717 that says the
following:
..........................
|
by: Mario Rodriguez |
last post by:
Hi people. I have a problem adding users to Win2003 active directory
programatically. When I execute my app throws the following exception:
.................The specified directory service attribute or value does not
exist...........
Exactly the same code works fine on my win2000 active directory. My app
include the use of the extensionAtributes and I'm not sure if the
extensionAttributes feature was removed from win2003 Active...
|
by: ASGMikeG |
last post by:
Hi,
How do I find the user object for the current user in Active Directory i.e.
the user running my program ?
Regards
Michael
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
| |
by: Leo_Surf |
last post by:
Hello,
I need your help adding user in Active Directory from ASP.net website. Could
any one provide me the complete code for the html page. As this is my
curriculam project and I dont have any Idea about ASP.net
Please Help
Thanks in Advance.
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://domain")
Dim mySearcher As New DirectorySearcher(enTry)
Dim resEnt As SearchResult
mySearcher.Filter = ("(objectClass=*)")
mySearcher.SearchScope = SearchScope.Subtree
|
by: Hriday |
last post by:
Hi there, Please help me..It is urgent
This is Hriday, working on windows authentication with
Active Directory...
My requirment is when a user sends a request to my web
Applicatoin I want to Pop up windows Authentication box so
that user will give his userId, Password & domain name for
authenticaion. After that I want to take these three info
of user and make a search in Active Directory.
|
by: RTT |
last post by:
here is my current situation. I develop a program on my computer's
localhost. From there i contact Active directory succesfull using a
connectionstring like: LDAP://OU=BE,OU=SE,DC=eu,DC=aagp,DC=corp. This works
fine. My computer is in and OU under the BE folder, and so is my User. I
have no problems connecting to the Active Directory.
But now that my code is finished i want to put it online on one of the
company servers. but when i...
|
by: Jim in Arizona |
last post by:
My goal, somehow, is to populate a dropdownlist with all the user names
in active directory. I don't even know where to begin, really.
I added a reference to System.DirectoryServices so I could use the
System.DirectoryServices.ActiveDirectory namespace. I don't even know if
this is the right way to go as I can't seem to find anything in that
namespace that would help me query active directory for names.
I can't use an LDAP query...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |