I m trying to connect to my Active Directory and fetch the attribute of my AD.
Whenever i trying to execute the console application made in c# i get following error.
Please Help
My code is as follows.
Whenever i trying to execute the console application made in c# i get following error.
Please Help
Code:
The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)
My code is as follows.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices.ActiveDirectory;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DirectoryEntryConfigurationSettings("LDAP://dc=abc,dc=com");
}
static void DirectoryEntryConfigurationSettings(string domainADsPath)
{
// Bind to current domain
DirectoryEntry entry = new DirectoryEntry(domainADsPath);
DirectoryEntryConfiguration entryConfiguration = entry.Options;
Console.WriteLine("Server: " + entryConfiguration.GetCurrentServerName());
Console.WriteLine("Page Size: " + entryConfiguration.PageSize.ToString());
Console.WriteLine("Password Encoding: " +
entryConfiguration.PasswordEncoding.ToString());
Console.WriteLine("Password Port: " +
entryConfiguration.PasswordPort.ToString());
Console.WriteLine("Referral: " + entryConfiguration.Referral.ToString());
Console.WriteLine("Security Masks: " +
entryConfiguration.SecurityMasks.ToString());
Console.WriteLine("Is Mutually Authenticated: " +
entryConfiguration.IsMutuallyAuthenticated().ToString());
Console.WriteLine();
Console.ReadLine();
}
}
}
Comment