如何从 Lotus Notes 获取 Internet 地址

发布于 2024-09-10 03:04:54 字数 480 浏览 5 评论 0原文

Notes 日历条目有一个名为“Chair”的项目,它是一个类似“CN=My Name/OU=Something/O=SomethingElse”的专有名称。如何将其转换为 SMTP 地址,例如“[电子邮件受保护] “?我尝试查看具有 Addr821 属性的 NotesName,但这似乎只有在您给它一个 SMTP 地址时才起作用 - 当给定一个可分辨名称时,Addr821 会返回相同的内容。

我看到的一种选择是使用地址簿,但如何使用可分辨名称查找它?

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

任何帮助将不胜感激。

我正在使用 c# 和 Interop.Domino.dll。

A Notes calendar entry has an Item called "Chair", which is a distinguished name along the lines of "CN=My Name/OU=Something/O=SomethingElse". How do I convert this to an SMTP address such as "[email protected]"? I tried looking at NotesName which has an Addr821 property, but this only seems to work if you give it an SMTP address - when given a distinguished name, Addr821 gives you back the same thing.

One option I see is to use the address book, but how do I look it up using a distinguished name?

I assume I could look it up using LDAP, but how does my code find out the LDAP server (which in this case is Novell)?

Any help would be appreciated.

I am using c# with Interop.Domino.dll.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

掐死时间 2024-09-17 03:04:54

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

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

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

另一种方法是“手动”在 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

I've never used interop.domino.dll, but I think these approaches might help you:

If you can use the evaluate function, you could use the @NameLookup formula:

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

Another approach is to "manually" look the name up in the Domino Directory:

  • Go through session.addressbooks, find one that's public and on a server.
  • Get the view $VIMPeople.
  • getDocumentByKey using the abbreviated name format.

Edit

Here is (untested) LotusScript code to get the InternetAddress for a given user, it should be relatively easy to translate into 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
燃情 2024-09-17 03:04:54
Sub Click(Source As Button)
    Dim session As NotesSession
    Dim directory As NotesDirectory

    Set session = New NotesSession
    Set directory = session.GetDirectory("")

    Dim mailinfo As Variant
    Dim ooo As String   
    Dim mailmsg As String   
    Dim mailname As String  
    'mailname = Inputbox$("Name of user")
    On Error Goto mailerror 
    ''''''''The Paremeters mean, GetMailInfo(The userName,GetServerInfo?,Flasg Error incase of Multiple Names Found?)
    'mailinfo = directory.GetMailInfo(mailname, False, True)
    mailinfo = directory.GetMailInfo("Eliud Ngugi", False, True)
    On Error Goto 0 

    Messagebox  "Internet Address "  & mailinfo(7) ,64
    Exit Sub
    mailerror:  
        Messagebox  Error(),, "Error number " & Err()
        Exit Sub
End Sub
Sub Click(Source As Button)
    Dim session As NotesSession
    Dim directory As NotesDirectory

    Set session = New NotesSession
    Set directory = session.GetDirectory("")

    Dim mailinfo As Variant
    Dim ooo As String   
    Dim mailmsg As String   
    Dim mailname As String  
    'mailname = Inputbox$("Name of user")
    On Error Goto mailerror 
    ''''''''The Paremeters mean, GetMailInfo(The userName,GetServerInfo?,Flasg Error incase of Multiple Names Found?)
    'mailinfo = directory.GetMailInfo(mailname, False, True)
    mailinfo = directory.GetMailInfo("Eliud Ngugi", False, True)
    On Error Goto 0 

    Messagebox  "Internet Address "  & mailinfo(7) ,64
    Exit Sub
    mailerror:  
        Messagebox  Error(),, "Error number " & Err()
        Exit Sub
End Sub
み青杉依旧 2024-09-17 03:04:54

如果您想手动:打开 Names.nsf 或使用“Directory Assistance”(具体细节我不知道),打开 $Users 视图并使用缩写用户名(源自“chair”名称)找到用户“person”文档),找到并使用“InternetAddress”字段值。这假定该字段已填充“当前/真实”电子邮件地址。

虽然 $Vim 视图(和其他视图)可能很有用,但您可能需要做更多工作来消除大型组织中用户名的歧义,以导出所需名称匹配的正确形式。

$Users 视图可以匹配缩写、通用用户名、名字、姓氏、简称和 soundex,通常是最有用的“查找”视图。它很可能是“完全构建”的,因为主笔记邮件路由器使用此视图来路由电子邮件。

要将名称转换为“可区分格式”,请使用 @name([Abbreviate]; name) 或 LotusScript 等效项:类似:

dim n as new notesName
Set n = session.CreateName(canonical/distinguished/name)
distname = n.abbreviated

If you want to go manually: open up the Names.nsf or use 'Directory Assistance' (details escape me), open up the $Users view and locate the users 'person' document using Abbreviated UserName (derived from the 'chair' name), locate and use the 'InternetAddress' field value. This presumes that this field has been populated with the 'current/real' email address.

While $Vim views (and others) can be useful, you might have more work to do to disambiguate user names in large orgainsations to derive the correct form of the name matching required.

$Users view can match on Abbreviated, Common User name, first, last, shortname and soundex and is generally the most useful 'lookup' view. It is most likely to be 'fully built' as the main notes mail router uses this view to route emails.

To convert the name to the 'distinguished format' use either @name([Abbreviate]; name) or the LotusScript equivalent: Something like:

dim n as new notesName
Set n = session.CreateName(canonical/distinguished/name)
distname = n.abbreviated
最单纯的乌龟 2024-09-17 03:04:54
Sub Click(Source As Button)

    Dim session As NotesSession
    Dim directory As NotesDirectory

    Set session = New NotesSession
    Set directory = session.GetDirectory("")

    Dim mailinfo As Variant
    Dim ooo As String   
    Dim mailmsg As String   
    Dim mailname As String  
    'mailname = Inputbox$("Name of user")
    On Error Goto mailerror 
    ''''''''The Paremeters mean, GetMailInfo(The userName,GetServerInfo?,Flasg Error incase of Multiple Names Found?)
    mailinfo = directory.GetMailInfo(mailname, False, True)
    mailinfo = directory.GetMailInfo("Eliud Ngugi", False, True)
    On Error Goto 0 

    Messagebox  "Internet Address "  & mailinfo(7) ,64
    Exit Sub
mailerror:  
    Messagebox  Error(),, "Error number " & Err()
    Exit Sub
End Sub
Sub Click(Source As Button)

    Dim session As NotesSession
    Dim directory As NotesDirectory

    Set session = New NotesSession
    Set directory = session.GetDirectory("")

    Dim mailinfo As Variant
    Dim ooo As String   
    Dim mailmsg As String   
    Dim mailname As String  
    'mailname = Inputbox$("Name of user")
    On Error Goto mailerror 
    ''''''''The Paremeters mean, GetMailInfo(The userName,GetServerInfo?,Flasg Error incase of Multiple Names Found?)
    mailinfo = directory.GetMailInfo(mailname, False, True)
    mailinfo = directory.GetMailInfo("Eliud Ngugi", False, True)
    On Error Goto 0 

    Messagebox  "Internet Address "  & mailinfo(7) ,64
    Exit Sub
mailerror:  
    Messagebox  Error(),, "Error number " & Err()
    Exit Sub
End Sub
晨曦慕雪 2024-09-17 03:04:54

如果他们有 Novell Identity Manager(它将数据从多个源同步到其他多个目标),并且您有一个用于 LDAP 连接的 eDirectory 实例,则只需读回 Mail 属性即可。

现在这取决于如何处理与 Notes 的同步。我通常会将 Notes 完全可分辨名称存储在 eDirectory 的属性中,因为正如您所指出的,拥有它很有用。

但是,如果此“主席”对象的类不是用户也不是组,则它们很可能没有同步它。 (数据库中的邮件是可能的常见第三类)。

If they have Novell Identity Manager, which would be synchronizing data from multiple sources to other multiple destinations, and you have an eDirectory instance to use for LDAP connectivity, just read back the Mail attribute.

Now it depends on how the sync to Notes is handled. I usually would store the Notes fully distinguished name in an attribute in eDirectory, since as you have noted, it is useful to have.

However, if the class of this "Chair" object is not a User nor a group, it is likely they are not synchronizing it. (Mail in DB's are a common third class that might be possible).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文