0

メールファイル名とサーバーがわかっている場合、対応するユーザーの完全修飾名を LotusScript を使用して「CN=xxx/O=yyy」の形式で取得するにはどうすればよいですか?

まず、ユーザーのユーザー名 (メールの @ の前の部分) を取得します: つまり、user1@example.com

このユーザーが登録されているサーバーも知っているので、次のように Registration.GetUserInfo を使用します。

Dim reg as New NotesRegistration
reg.RegistrationServer = "CN=myserver/O=mydomain"
Call reg.GetUserInfo("user1", mailserver$, mailfile$)

問題は、このデータからユーザーの氏名を取得するにはどうすればよいかということです。

4

4 に答える 4

3

以下は、Jonesys の提案の簡単な実装です。

Function getMailFileUser(mailserver As String, mailfile As String) As String
    On Error Goto errorthrower  
    Dim session As New notessession

    Dim dd As NotesDatabase
    Forall candidate_dd In session.AddressBooks
        If candidate_dd.Server<>"" And candidate_dd.IsPublicAddressBook Then
            Set dd = candidate_dd
            Exit Forall
        End If
    End Forall 
    If dd Is Nothing Then Error 1978,"Failed to find Domino Directory"
    If Not dd.IsOpen Then Call dd.Open("","")


    Dim userdocs As NotesDocumentCollection
    Set userdocs = dd.Search({form="Person" & }& _
    {@name([CANONICALIZE];MailServer)=@name([CANONICALIZE];"} & mailserver & {") & } &_
    {MailFile="} & mailfile & {"},Nothing,1)

    Dim userdoc As NotesDocument
    Set userdoc = userdocs.GetFirstDocument
    If Not userdoc Is Nothing Then
        getMailFileUser = userdoc.FullName(0)       
    Else
        getMailFileUser=""
    End If

    Exit Function
ErrorThrower:
    Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )
End Function

いくつかの注意事項:

  • CANONICALIZEドミノ ディレクトリではなく、現在の ID から値をmailserver取得します。これが機能するには、入力が省略形または正規化された形式である必要があります。
  • MailFileフィールドには拡張子が含まれる場合と含まれない場合があります。.nsf
  • Windows ではファイル名の大文字と小文字が区別されるとは思いませんが、他のプラットフォームでは区別される可能性があります。

これらの検索を頻繁に行う必要がある場合は、計算された検索テーブルまたは Domino ディレクトリ内のビューがおそらく最も効率的なソリューションです。

于 2010-02-05T09:02:52.370 に答える
1

メールファイル名がわかっている場合は、それをキーとして NAB を検索し、その方法で完全な名前を取得してみませんか?

于 2010-01-26T14:55:00.587 に答える
0

私はこの解決策に行き着きました(ユーザーのAddressBookサーバーがどれかを知っているため):

macro$ = { @DbLookup( "" ; "} & regServer & _
         {" : "names.nsf" ; "($Users)" ; "} & shortName & {" ; "FullName" ) }

Dim namelist As Variant

namelist = Evaluate ( macro$ )

commonName = namelist(0)
于 2010-02-05T16:06:20.973 に答える
0

インターネットアドレスがあれば、NotesName クラスを使用できます。

Dim s As New NotesSession
Dim userName As NotesName
Dim canonicalName as String

Set userName = s.CreateName("user@yourdomain.com")
'You can use the previous line or the next line to get the NotesName object
'Set userName = new NotesName("user@yourdomain.com")

canonicalName = userName.Canonical
于 2010-02-05T14:30:06.210 に答える