locked
getting sid (username) from an smtp email address RRS feed

  • Question

  • I am using the EWS Managed API, and the ExpandGroup and/or ResolveName function to get the details of a distribution list. I am ables to get the email details and the contact details for the group, but I cannot find anywhere the alias/sid/username property, which i need. all i am able to get is the actual first/last name or email address. is there a different way to get this property or a way to convert teh smpt email to a username?
    Tuesday, October 13, 2009 8:02 AM

Answers

  • EWS wont return any extra information about the account bar the email and name information but you should be able to use the EmailAddress just to look at the account information via LDAP eg

                string emEmailAddress = "userATdomain.com";
                DirectorySearcher sfSearch = new DirectorySearcher();
                sfSearch.Filter = "(mail=" + emEmailAddress + ")";
                SearchResultCollection srSearchResults = sfSearch.FindAll();
                foreach (SearchResult srSearchResult in srSearchResults)
                {
                    DirectoryEntry usrObj = srSearchResult.GetDirectoryEntry();
                    Console.WriteLine(usrObj.Properties["samaccountname"].Value.ToString());
                }
    Cheers
    Glen
    • Marked as answer by nweiser Wednesday, October 14, 2009 8:56 AM
    Wednesday, October 14, 2009 1:21 AM

All replies

  • EWS wont return any extra information about the account bar the email and name information but you should be able to use the EmailAddress just to look at the account information via LDAP eg

                string emEmailAddress = "userATdomain.com";
                DirectorySearcher sfSearch = new DirectorySearcher();
                sfSearch.Filter = "(mail=" + emEmailAddress + ")";
                SearchResultCollection srSearchResults = sfSearch.FindAll();
                foreach (SearchResult srSearchResult in srSearchResults)
                {
                    DirectoryEntry usrObj = srSearchResult.GetDirectoryEntry();
                    Console.WriteLine(usrObj.Properties["samaccountname"].Value.ToString());
                }
    Cheers
    Glen
    • Marked as answer by nweiser Wednesday, October 14, 2009 8:56 AM
    Wednesday, October 14, 2009 1:21 AM
  • thanks!!!!!!
    Wednesday, October 14, 2009 8:56 AM