2017-08-09 48 views
0

,我們使用MS Outlook和Skype。在這兩個應用程序中,我可以點擊幾個用戶來獲取有關它們的信息,如名字,姓氏,可用性,電子郵件地址或WindowsIdentification.Name(我認爲這稱爲Live ID)的信息。在我的公司獲取Windows LiveID名和姓

enter image description here 它看起來像在攝食。我剛剛從照片中刪除了個人信息。

是否有可能通過其姓名請求任何用戶的這些信息?

我正在尋找的功能是:

/*This function exists*/ 
System.Security.Principal.WindowsIdentity.GetCurrent().Name; 

但我不想知道我自己的LiveID而是由其他的用戶ID。所以,我需要這樣的東西:

/*This function does not exists*/ 
string UID = System.Security.Principal.WindowsIdentity.GetByName("Max Mustermann").Name; 
Console.WriteLine(UID) /*prints DomainName/UserID*/ 

就像在.NET中可用?

+0

另一種方法是,搜索Outlook地址簿。使用谷歌,我發現可能的方式來導出整個地址簿,但這不是我的選擇。但使用c#自動化搜索將幫助我... – Jan021981

回答

0

您可以使用DirectorySeacher類來執行此操作。

例如:

DirectorySearcher searcher1 = new DirectorySearcher(entry); 
searcher1.Filter = string.Format("(&(objectCategory=person)(objectClass=user)(givenname={0})(sn={1}))", aName, aSName); 

SearchResultCollection results1; 
results1 = searcher1.FindAll();