问题描述
您好,
我正在编写一个vb.net代码,我想要检索与分发列表关联的电子邮件地址(而不是DL中映射的电子邮件地址) )。
例如,如果有名为ABC-Support的DL,其关联的邮件ID为[email protected]。在我的应用程序中,当用户在文本框中键入名称ABC-Support时,它应该检索邮件地址[email protected]
能够搜索任何用户名,但在尝试DL名称时,它无法正常工作。也许我错过了一些简单的事有人可以帮我这个吗?
deActiveDirectoryEntry = 新 DirectoryEntry ( GC:// RootDSE)
dsAuthenticateDirectorEntry = New DirectoryEntry( String .Concat( GC://,deActiveDirectoryEntry.Properties( rootDomainNamingContext)。 Value.ToString()))
dsSearchDir = 新 DirectorySearcher(dsAuthenticateDirectorEntry)
dsSearchDir.Filter = (&(objectClass = user)(|(displayName = + strPRID + )(distinguishedName = + strPRID + )))
dsSearchDir.PropertiesToLoad.Add( mail)
srResultValue = dsSearchDir.FindOne()
usermail = srResultValue.Properties( mail)( 0 )
(objectClass = User)(objectClass = Group)
>
Hello,
Am writing a vb.net code where I want to retrieve the email address associated with a Distribution list (not the email addresses mapped in the DL).
For example, if there is a DL named ABC-Support and its associated mail id is [email protected]. In my application when a user types the name "ABC-Support" in the text box, it should retrieve the mail address "[email protected]"
Am able to do the search for any username, but while trying for DL name it is not working. Maybe am missing something simple. Can someone please help me with this?
deActiveDirectoryEntry = New DirectoryEntry("GC://RootDSE") dsAuthenticateDirectorEntry = New DirectoryEntry(String.Concat("GC://", deActiveDirectoryEntry.Properties("rootDomainNamingContext").Value.ToString())) dsSearchDir = New DirectorySearcher(dsAuthenticateDirectorEntry) dsSearchDir.Filter = "(&(objectClass=user)(|(displayName=" + strPRID + ") (distinguishedName=" + strPRID + ")))" dsSearchDir.PropertiesToLoad.Add("mail") srResultValue = dsSearchDir.FindOne() usermail = srResultValue.Properties("mail")(0)
这篇关于如何从Active Directory检索与DL关联的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!