ldap如何搜索联系人中的电子邮件地址?第二/第三备用电子邮件地址?
我有一个包含电子邮件联系人的 LDAP 服务器,以便我可以按姓名/电子邮件等查找联系人。但是,它似乎只搜索并查找任何联系人的第一个电子邮件地址。
例如,如果我有一个人:
LastName: Doe
FirstName: John
Email: [email protected]
Email2: [email protected]
Email3: [email protected]
它只搜索或返回第一封电子邮件。例如,如果我搜索“John”,它将仅返回“[email protected] ]”,即使其他两个电子邮件地址中包含“john”。我尝试过的搜索过滤器是:
//This one will both look through and match the first email but ignores the 2nd/3rd
(|(displayName=*%v*)(mail=*%v*)(uid=*%v*)(givenname=*%v*)(sn=*%v*)(cn=*%v*))
//This one throws an error saying "mail2" and "mail3" are invalid filters.
(|(displayName=*%v*)(mail=*%v*)(mail2=*%v*)(mail3=*%v*)(uid=*%v*)(givenname=*%v*)(sn=*%v*)(cn=*%v*))
我应该使用什么?
另外,是否有人有某个页面的链接,该页面列出了我可以在 LDAP 人员搜索中放入的所有可能的过滤器?
I have an LDAP server with my email contacts so that I can lookup contacts by name/email, etc. However, it only seems to search and find the first email address for any contact.
For example, if I have a person:
LastName: Doe
FirstName: John
Email: [email protected]
Email2: [email protected]
Email3: [email protected]
It only searches through or returns the first email. For example, if I search for "John", it will return only the "[email protected]" even though the other two email addresses have "john" in them. The search filters I've tried are:
//This one will both look through and match the first email but ignores the 2nd/3rd
(|(displayName=*%v*)(mail=*%v*)(uid=*%v*)(givenname=*%v*)(sn=*%v*)(cn=*%v*))
//This one throws an error saying "mail2" and "mail3" are invalid filters.
(|(displayName=*%v*)(mail=*%v*)(mail2=*%v*)(mail3=*%v*)(uid=*%v*)(givenname=*%v*)(sn=*%v*)(cn=*%v*))
What should I be using?
Also, does anyone have a link to some page that lists all the possible filters I can put in an ldap person search?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Exchange 不会在 mail2 或 mail3 等字段中存储其他邮件地址。所有地址都存储在多值字段“proxyAddresses”中。该字段为每个地址包含一行,格式为
地址类型:地址
示例:
smtp: [电子邮件受保护]
SMTP:[email protected]
示例中的第二个条目是主地址对于该帐户,因为 SMTP 前缀全部大写。
所以你会搜索 (proxyAddress=%v) 或类似的内容。我不知道 LDAP 搜索语法是什么。
编辑:另一种选择是使用 EWS Web 服务的 ResolveNames 操作(请参阅 http://www.infinitec.de/post/2009/04/13/Resolving-the-primary-email-address-with-Exchange-WebServices-ResolveNames-operation.aspx 和http://msdn.microsoft.com/en-us/library/aa563518(v=exchg.140).aspx)。
Exchange does not store additional mailaddresses in fields like mail2 or mail3. All addresses are stored in the multi-valued field "proxyAddresses". This field contains one line for each address in the form of
address-type:address
Example:
smtp:[email protected]
SMTP:[email protected]
The second entry in the example would be main address for that account, because the SMTP prefix is all uppercase.
So you would search for (proxyAddress=%v) or something like that. I don't know the LDAP search syntax out of my head.
Edit: Another option is to use the ResolveNames operation of the EWS webservices (see http://www.infinitec.de/post/2009/04/13/Resolving-the-primary-email-address-with-Exchange-WebServices-ResolveNames-operation.aspx and http://msdn.microsoft.com/en-us/library/aa563518(v=exchg.140).aspx).
过滤器:
将与条目: 不匹配,
因为没有过滤器断言与给定条目中的任何属性名称匹配。
会匹配的。您是否考虑过对您提供的示例条目使用标准名称?
The filter:
will not match the entry:
because none of the filter assertions match any of the attribute names in the given entry.
would match. Have you considered using the standard names for the example entry you give?
Active Directory 发布时带有一些值得怀疑的架构选择。现在很难修复它们。
其中之一是邮件被标记为单值。这应该是一个多值属性。因此,使用 proxyAddresses,它尝试使用 smtp: 或 x500: 或 SIP: 来使用更多信息来重载字符串语法属性,以指示地址的协议。那么大写 (SMTP) 表示主要,小写 (smtp) 表示次要。
当 PhoneNumber 为单值时也会发生这种情况,并且额外的值现在溢出到属性 otherPhone 中。
同样适用于:
Active Directory was released with some schema choices that are questionable. Now it is hard to fix them.
One of those is that mail, was flagged as single valued. This should have been a multivalued attribute. Thus the use of proxyAddresses, where it tries to overload a string syntax attribute with more information by using smtp: or x500: or SIP: to indicate a protocol for the address. Then upper case (SMTP) means primary and lower case (smtp) means secondary.
This also occured for telephoneNumber being single valued, and extra values now overflow into the attribute otherPhone.
Same for: