mic*_*ael 2 c# lotus-notes ldap
Notes日历条目有一个名为"Chair"的项,它是"CN = My Name/OU = Something/O = SomethingElse"行的可分辨名称.如何将其转换为SMTP地址,例如"my.name@company.com"?我试着查看具有Addr821属性的NotesName,但是只有在给它一个SMTP地址时这似乎才有效 - 当给出一个可分辨的名称时,Addr821会给你相同的东西.
我看到的一个选项是使用地址簿,但如何使用专有名称查找?
我假设我可以使用LDAP查找它,但我的代码如何找出LDAP服务器(在本例中是Novell)?
任何帮助,将不胜感激.
我正在使用C#与Interop.Domino.dll.
我从未使用过interop.domino.dll,但我认为这些方法可能对您有所帮助:
如果您可以使用该evaluate功能,您可以使用以下@NameLookup公式:
evaluate("@NameLookup([Exhaustive];Chair;'InternetAddress')",CalendarDocument)
Run Code Online (Sandbox Code Playgroud)
另一种方法是在Domino目录中"手动"查找名称:
session.addressbooks,找到一个公共和服务器上的.$VIMPeople.getDocumentByKey 使用缩写名称格式. 编辑
这是(未经测试的)LotusScript代码来获取给定用户的InternetAddress,它应该相对容易转换为c#:
Function GetInternetAddress(username as string) as string
On Error Goto errorthrower
dim session as new NotesSession
dim dominodirectory as NotesDatabase
dim notesusername as new NotesName(username)
forall candidate in session.AddressBooks
if candidate.isPublicAddressBook and candidate.Server <> "" then
set dominodirectory = candidate
exit forall
end if
end forall
if dominodirectory is nothing then error 1900,"Failed to find Domino Directory."
if not dominodirectory.isOpen then call dominodirectory.open("","")
dim view as NotesView
set view = dominodirectory.getView("$VIMPeople")
dim document as notesdocument
set document = view.getDocumentByKey(notesusername.Abbreviated, true)
if document is nothing then error 1900,"Failed to find document matching '" & username & "'"
GetInternetAddress = document.InternetAddress(0)
Exit Function
ErrorThrower:
Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )
End Function
Run Code Online (Sandbox Code Playgroud)