gpt4 book ai didi

c# - 如何从 Lotus Notes 获取 Internet 地址

转载 作者:行者123 更新时间:2023-11-30 19:07:49 25 4
gpt4 key购买 nike

Notes 日历条目有一个名为“Chair”的项目,它是一个类似于“CN=My Name/OU=Something/O=SomethingElse”的专有名称。如何将其转换为 SMTP 地址,例如“my.name@company.com”?我试着查看具有 Addr821 属性的 NotesName,但这似乎只有在您给它一个 SMTP 地址时才有效 - 当给定一个专有名称时,Addr821 会返回同样的东西。

我看到的一个选项是使用地址簿,但如何使用专有名称查找它?

我假设我可以使用 LDAP 查找它,但是我的代码如何找到 LDAP 服务器(在本例中是 Novell)?

如有任何帮助,我们将不胜感激。

我正在使用带有 Interop.Domino.dll 的 c#。

最佳答案

我从未使用过 interop.domino.dll,但我认为这些方法可能对您有所帮助:

如果可以使用evaluate 函数,则可以使用@NameLookup 公式:

evaluate("@NameLookup([Exhaustive];Chair;'InternetAddress')",CalendarDocument)

另一种方法是“手动”在 Domino 目录中查找名称:

  • 浏览 session.addressbooks,找到一个在服务器上公开的地址簿。
  • 获取 View $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

关于c# - 如何从 Lotus Notes 获取 Internet 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3279094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com