2010-07-19 129 views
2

的Notes日历条目有所谓的“椅子”的项目,这是线沿线的一个专有名称Internet地址“CN =我的名称/ OU =东西/ O = SomethingElse”。如何将其转换为SMTP地址,如“[email protected]”?我试着查看NotesName,它有一个Addr821属性,但是这似乎只适用于你给它一个SMTP地址 - 当给出一个可分辨名称时,Addr821可以让你回到同样的事情。如何获得从Lotus Notes

一种选择我看到的是使用地址簿,但我怎么看它使用专有名称?

我以为我可以看看它使用LDAP,但如何我的代码找出LDAP服务器(在这种情况下是Novell)?

任何帮助,将不胜感激。

我使用C#与Interop.Domino.dll。

回答

7

我从来没有用过interop.domino.dll,但我认为这些方法可以帮助你:

如果你可以使用evaluate功能,您可以使用@NameLookup公式:

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

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

  • 通过session.addressbooks,找到一个公共的和服务器上的名称。
  • 获取视图$VIMPeople
  • getDocumentByKey使用缩写名称格式。

编辑

这里是(未经测试)LotusScript代码来获取网际地址给定用户,应该是比较容易翻译成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 
+0

可以或许请详细说明“使用缩写名称格式的getDocumentByKey”? – Ryk 2011-05-18 05:34:26

+1

用一些检验代码更新了我的答案。 – 2011-05-18 07:44:22

+0

谢谢,真的有帮助 – Ryk 2011-05-19 00:22:20

0

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

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

然而,如果类这种“椅子”的对象不是用户,也不是一个基团,它很可能它们不是同步的。 (DB中的邮件是常见的第三类,可能是可能的)。

1

如果您想要手动操作:打开Names.nsf或使用'Directory Assistance'(详情请转义我),打开$ Users视图并使用缩写的用户名(找到用户的文档) '主席'名称),找到并使用“InternetAddress”字段值。这假设这个字段已经填充了'当前/真实'的电子邮件地址。

虽然$ VIM意见(和其他人)可能是有用的,你可能有更多的工作要做,以消除歧义大orgainsations用户名导出所需的名称匹配的正确形式。

$用户视图可以匹配缩写,通用用户名,第一个,最后一个,短名和soundex,通常是最有用的'lookup'视图。由于主笔记邮件路由器使用此视图来路由电子邮件,因此它很可能是“完全构建”的。

将名称转换为 '杰出的格式' 请使用@name([缩写];名称)或等效的LotusScript:是这样的:

dim n as new notesName 
Set n = session.CreateName(canonical/distinguished/name) 
distname = n.abbreviated 
1
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 
3
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