static void Main(string[] args) { // 180 doesnt have proper permissions // 181 doesnt have the directory // 182 is just great string path = "\\\\VMSRVGVS182\\c$\\ErrorLogger\\config.xml"; /*try * { * Stream inStream = File.Open(path, FileMode.Open); * inStream.Close(); * } * catch (UnauthorizedAccessException authEx) * { * Console.WriteLine(String.Format("You do not have proper permissions: {0}", authEx.Message)); * } * catch (DirectoryNotFoundException dirEx) * { * Console.WriteLine(String.Format("Directory not found: {0}", dirEx.Message)); * } * catch * { * Console.WriteLine("Something went wrong, you just suck"); * }*/ /*try * { * XmlDocument xml = new XmlDocument(); * xml.Load(path); * } * catch (UnauthorizedAccessException authEx) * { * } * catch (DirectoryNotFoundException dirEx) * { * * }*/ //DictionaryEntry d = new DictionaryEntry(); //d.Key = "hi"; //d.Value = "everyone"; // Just checking to see if the new AD Tools plays nicely ADManager manager = new ADManager(LordDomains.LORD); ADUser user = manager.GetUserByAccountName("tyler_ewing"); Console.WriteLine(user.Email); Console.ReadLine(); }
static void Main(string[] args) { // 180 doesnt have proper permissions // 181 doesnt have the directory // 182 is just great string path = "\\\\VMSRVGVS182\\c$\\ErrorLogger\\config.xml"; /*try { Stream inStream = File.Open(path, FileMode.Open); inStream.Close(); } catch (UnauthorizedAccessException authEx) { Console.WriteLine(String.Format("You do not have proper permissions: {0}", authEx.Message)); } catch (DirectoryNotFoundException dirEx) { Console.WriteLine(String.Format("Directory not found: {0}", dirEx.Message)); } catch { Console.WriteLine("Something went wrong, you just suck"); }*/ /*try { XmlDocument xml = new XmlDocument(); xml.Load(path); } catch (UnauthorizedAccessException authEx) { } catch (DirectoryNotFoundException dirEx) { }*/ //DictionaryEntry d = new DictionaryEntry(); //d.Key = "hi"; //d.Value = "everyone"; // Just checking to see if the new AD Tools plays nicely ADManager manager = new ADManager(LordDomains.LORD); ADUser user = manager.GetUserByAccountName("tyler_ewing"); Console.WriteLine(user.Email); Console.ReadLine(); }
private void usernameTextBoxTextChanged(object sender, EventArgs e) { // Each time a letter is typed it checks AD for the user and updates the Status message and button availability ADManager ad = new ADManager(LordDomains.LORD); // I only use a try if someone in case someone enters crazy characters *^#$^& try { adUser = usernameTextBox.Text != string.Empty ? ad.GetUserByAccountName(usernameTextBox.Text) : null; } catch (Exception exc) { Console.WriteLine(exc.Message); } bool userExists = adUser != null; addUserButton.Enabled = userExists; statusMessage.Text = userExists ? adUser.AccountName.Replace('_', ' ') + " is a valid user" : usernameTextBox.Text == string.Empty ? string.Empty : "That username does not exist in AD"; }