Hi all..
I got windows users name by following code -
public void DNames()
{
List<String> cnames = new List<String>();
System.DirectoryServices.DirectoryEntry ent = new System.DirectoryServices.DirectoryEntry("WinNT://in.abc.com")
foreach (System.DirectoryServices.DirectoryEntry nn in ent.Children)
cnames.Add(nn.Name);
}
------
How to get all emp detail with this domain - in.abc.com - without using LDAP...
Emp details - First Name, Last Name, Code, Leaving Date, Office Location, Email etc.
Please help !!
Loading
Riddhi ValechaPosted Jul 11, 2016, 6:22 AM
Riddhi ValechaPosted Jun 27, 2016, 12:53 PM
I have a domain – abc.xyz.com (Right Click on My Computer -> Domain)
HostName
DomainName
LastLogin
Bad Password
Email
Emp Code
EmpName
Full Name
Depaartment
Offlice Location
Manager
Contact
DT0012345
Abc.def
10-feb-2015 6:7:44
4
[email protected]
E1
Mahesh Bhatt
Mahesh Bhatt
Database
Jamnagar, Gujarat
Rajesh Bhatt
4567890
DT0056789
Fhi.jkl
10-feb-2015 5:5:5
2
[email protected]
E2
Shruti Shah
Shruti Shah
Testing
Silvasa , Gujarat
Rajesh Bhatt
8765443322
Sibeesh VenuPosted Jun 20, 2016, 1:14 AM
Riddhi ValechaPosted Jun 16, 2016, 4:49 AM
users data/properties -> Properties - ResultPropertyCollection, ResultPropertyValueCollection
And bind the result with GridView...
Also, what to do if I want the all details for only 50 users ??
I have a string array -
string[] users = new string[] {"A", "B", "C"};
These are also in same domain...
PLease guide.... It is a bit urgent...
Riddhi ValechaPosted Jun 14, 2016, 8:30 AM
Jignesh TrivediPosted Jun 13, 2016, 11:59 PM
Riddhi ValechaPosted Jun 13, 2016, 1:39 PM
Khargesh RajputPosted Jun 13, 2016, 12:56 PM
Riddhi ValechaPosted Jun 13, 2016, 4:39 AM
protected DataTable GetUsers()
{
string connection = "LDAP://ads.yourwebsite.com";
DirectoryEntry de = new DirectoryEntry(connection); // Authentication details
DirectorySearcher searcher1 = new System.DirectoryServices.DirectorySearcher();
searcher1.SearchRoot = de;
searcher1.SearchScope = SearchScope.Subtree;
SearchResultCollection results1;
results1 = searcher1.FindAll();
if (results1 != null)
{
// Create a table and populate it with properties to bind to gridview
DataTable myTable = new DataTable("ActiveDir");
myTable.Columns.Add(new DataColumn("Key", System.Type.GetType("System.String")));
myTable.Columns.Add(new DataColumn("Value", System.Type.GetType("System.String")));
DataRow myRow;
foreach (SearchResult r in results1)
{
// DirectoryEntry de = r.GetDirectoryEntry();
de = r.GetDirectoryEntry();
foreach (string propName in de.Properties.PropertyNames)
{
myRow = myTable.NewRow();
myRow[0] = propName;
myRow[1] = de.Properties[propName].Value == null ? "" : de.Properties[propName].Value.ToString();
myTable.Rows.Add(myRow);
}
}
return myTable;
}
else
{
return null;
}
}
----------------------
But, I want to get the result in other tabular format -
DomainUser | SamaAccont| Email |..... and other property name as headings.
ABC | A B C | [email protected] .... values...
-----------
Also, how to get this for 5 users (say - A ,B, C, D, E) - so that code runs fast for 5 users and I can get same for all users ??
PLease guide....
Riddhi ValechaPosted Jun 12, 2016, 10:02 AM
I just have one thing in common - Domain (in.abc.com)
Also, I have all windows users list...
Now, from this window user (since they are all unique), how to get all the details -
First Name, Last Name, Emp Code, Company joining date, Leaving date, email id, machines IP address, machine guid, machine mac address, etc.
I do not have LDAP User and Password.
Vinay SinghPosted Jun 8, 2016, 11:06 PM
Riddhi ValechaPosted Jun 8, 2016, 1:37 PM
Vinay SinghPosted Jun 7, 2016, 3:14 AM
Praveen SreeramPosted Jun 7, 2016, 12:38 AM