473,597 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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");
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchSc ope = SearchScope.Sub tree;
foreach(SearchR esult result in search.FindAll( ))
{
foreach(string propertyname in result.Properti es.PropertyName s)
{
Trace.Warn(prop ertyname);
Trace.Warn(resu lt.Properties[propertyname][0].ToString());
}

}
}
Nov 16 '05 #1
4 3422
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******@hotma il.com> wrote in message
news:1a******** *************** **@posting.goog le.com...
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");
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchSc ope = SearchScope.Sub tree;
foreach(SearchR esult result in search.FindAll( ))
{
foreach(string propertyname in result.Properti es.PropertyName s)
{
Trace.Warn(prop ertyname);
Trace.Warn(resu lt.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******* *******@TK2MSFT NGP10.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******@hotma il.com> wrote in message
news:1a******** *************** **@posting.goog le.com...
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");
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(cn=" + Session["UserId"].ToString()+ ")";

search.SearchSc ope = SearchScope.Sub tree;
foreach(SearchR esult result in search.FindAll( ))
{
foreach(string propertyname in result.Properti es.PropertyName s)
{
Trace.Warn(prop ertyname);
Trace.Warn(resu lt.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******* *******@TK2MSFT NGP10.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
7369
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 20-30 different domains) with 25K+ users. i dont want to use "NT challenge response" for this pupose. I am exploring ways using ADSI and WMI to query the Active directory by using the IP address in the incoming web request and trying to figure...
1
1649
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 'full name' of the user that logs into it. Once the user full nam ehas been retreived (using adsi) the user can reload the page and it appears to just check a cached version of the request (since the page loads very fast). If however the user...
2
2444
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 (i.e. Mobile Phone Number) we get a failure as below... Error Number:- -2147467259 Automation error Unspecified error Can anyone see why this is happenning? Whe nwe run the DLL from VB6 or
14
5207
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 and find properties for these things but have not had any luck so far. Also i did a search on the Platform SDK doc's. It has examples in VB and C++ but these are not using DotNet and dont give any hint to a property that may be used. They seem...
8
1785
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 hardcoded, I cannot make this same code happen. This is all I am trying to do: static void Stuff() { //we don't need the credentials on this form // so store in session state.
1
1257
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 method is not supported by the server. Any help with this would be appreciated.
6
2455
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 function exactly as outlined in the below link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT02.asp
3
2230
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 services. eDirectory uses the "userPassword" property to change the password and for a normal user, this has to be deleted and then added to in one LDAP modify operation to successfully change the password. As far as i know eDirectory schema does...
1
2581
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 get them. They already exist. I believe if I do the equivalent in VB I would generate an error when I try to get an object that does not exist (can not find). What have I done wrong? I have included the function below that works in ever respect...
3
5607
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 want to give them the opportunity to run these modules from home as well, we are trying to get the USERNAME/COMPUTERNAME as well, so the students, when they sign up for the modules, they can ONLY run the modules fromhome PC. We found a nice...
0
7959
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8263
Oralloy
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...
0
8379
jinu1996
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...
0
8254
tracyyun
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...
0
6677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5842
isladogs
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...
0
3876
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1492
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.