2010-07-19 130 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