473,379 Members | 1,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Help with ADSI C#

My code is as shown below. I am trying to extract the logged on user's
email id. I get all properties except emailid.
Please can anybody help.
Thanks
Sumana

public void getemail()
{
DirectoryEntry entry = new DirectoryEntry("LDAP://xyz");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchScope = SearchScope.Subtree;
foreach(SearchResult result in search.FindAll())
{
foreach(string propertyname in result.Properties.PropertyNames)
{
Trace.Warn(propertyname);
Trace.Warn(result.Properties[propertyname][0].ToString());
}

}
}
Nov 16 '05 #1
4 3403
What makes you think there is such a property in the directory?
What directory service are you connecting to?
What object are you binding to?
Willy.

"Sumana" <su******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
My code is as shown below. I am trying to extract the logged on user's
email id. I get all properties except emailid.
Please can anybody help.
Thanks
Sumana

public void getemail()
{
DirectoryEntry entry = new DirectoryEntry("LDAP://xyz");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchScope = SearchScope.Subtree;
foreach(SearchResult result in search.FindAll())
{
foreach(string propertyname in result.Properties.PropertyNames)
{
Trace.Warn(propertyname);
Trace.Warn(result.Properties[propertyname][0].ToString());
}

}
}

Nov 16 '05 #2
Hello Willy,
I can get the displayname and when the user password expires etc
from the directory services. I read many posts where in you can
extract email ids. I was pretty sure there would be a key called
emailaddress or mail for which i can get the value. Am i missing
something or what is the other way of getting email ids of the users
connected to the above domain.
Thanks
Sumana

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:<uz**************@TK2MSFTNGP10.phx.gbl>...
What makes you think there is such a property in the directory?
What directory service are you connecting to?
What object are you binding to?
Willy.

Nov 16 '05 #3
What makes you think there is such a property in the directory?
What directory service are you connecting to?
What object are you binding to?
Willy.

"Sumana" <su******@hotmail.com> wrote in message
news:1a*************************@posting.google.co m...
My code is as shown below. I am trying to extract the logged on user's
email id. I get all properties except emailid.
Please can anybody help.
Thanks
Sumana

public void getemail()
{
DirectoryEntry entry = new DirectoryEntry("LDAP://xyz");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchScope = SearchScope.Subtree;
foreach(SearchResult result in search.FindAll())
{
foreach(string propertyname in result.Properties.PropertyNames)
{
Trace.Warn(propertyname);
Trace.Warn(result.Properties[propertyname][0].ToString());
}

}
}

Nov 16 '05 #4
Hello Willy,
I can get the displayname and when the user password expires etc
from the directory services. I read many posts where in you can
extract email ids. I was pretty sure there would be a key called
emailaddress or mail for which i can get the value. Am i missing
something or what is the other way of getting email ids of the users
connected to the above domain.
Thanks
Sumana

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:<uz**************@TK2MSFTNGP10.phx.gbl>...
What makes you think there is such a property in the directory?
What directory service are you connecting to?
What object are you binding to?
Willy.

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Akhlaq Khan | last post by:
we are developing an intranet application (web based) which needs to detect the logged in user ID of the user hitting the website. the intranet is huge and based on win2k active directory (around...
1
by: Ryan Ritten | last post by:
I was wondering if anyone knew how (or if it's even possible) to cache the results of an ADSI call in asp for a longer period of time. Basically what I am doing is I have a website that loads the...
2
by: Enigma Webmaster | last post by:
Hi All, We've written a couple of functions which, when run in VB6 work fine and allow AD users to be updated. When we include the code into an ASP Page and try and update a users information...
14
by: Arran Pearce | last post by:
Hi, I am looking for a way to use System.DirectoryServices to find all users on a domain whos accounts are either locked out or disabled. I have used ADSIEdit and the mmc schema add-in to try...
8
by: msnews.microsoft.com | last post by:
I have ADSI code that I can make work at the command line. I cannot in any way get it to work in asp.net. Even using Windows authentication, impersonation on, and providing the credentials...
1
by: sck10 | last post by:
Hello, I am running the routine below and I am getting the following error at For Each result In srcLDAP.FindAll. System.Runtime.InteropServices.COMException. The requested authentication...
6
by: varkey.mathew | last post by:
Dear all, Bear with me, a poor newbie(atleast in AD).. I have to authenticate a user ID and password for a user as a valid Active Directory user or not. I have created the IsAuthenticated...
3
by: chat_devil | last post by:
hi, does anyone know if it is possible to remove an attribute that can not be read into the ADSI property cache/collection. i'm trying to do an eDirectory password change from .net directory...
1
by: LittlePython | last post by:
I am a little confused on why I can not detect an object that does not exist with a try and except. If I understand ADSI correctly from what I have read you do not create these objects but rather...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.