近期公司調整了郵件架構出現了一些問題,這些問題其實是我們日常接觸到的,隻是想到了沒有更好的去做而已,作為一個管理者應該會的東西,那是什麼呢,具體是這樣的,由于Domino目錄下人員多,或者郵件組比較多的話,如果通過搜尋的方式比較麻煩,非常慢沒有效率,這樣我們就通過手動的方式将編輯好的格式檔案粘貼,這樣容易出問題,如果名稱寫錯,給相應的郵件組發送郵件會提示錯誤,說使用者不在Domino清單中,那有什麼好的方法來檢測 郵件組的成員是否在Domino目錄下呢,有,那就是通過代理來實作。
我本身在Domino運維上是一個菜鳥,在Domino開發上更是一個菜菜鳥了,近期看了很多資料跟看天書一樣不懂,近期通過Lotus論壇、Lotus QQ群交到了一些朋友,通過互相了解互相信任及互相學習進步,了解了一點知識來實驗測試該問題,具體見下“
我環境内有兩台Domino server
Server1:Dsgrd-mail01
Server2:Dsgrd-mail02
Globle Name:Dsgrd.com
Domino清單下分别注冊了一些使用者,分别為注冊在兩個伺服器上面,
User1、users2、user3注冊在Dsgrd-mail01上
User11、user12、user13注冊在Dsgrd-mail02上
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083445H6qG.jpg" target="_blank"></a>
然後建立相應郵件組(群組)
<a href="mailto:[email protected]">[email protected]</a>
<a href="mailto:[email protected]">[email protected]</a>
<a href="mailto:[email protected]">[email protected]</a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083445D39Y.jpg" target="_blank"></a>
我們在Test1添加使用者;如果通過搜尋的方式添加使用者的話,其實是按照政策中設定按照使用者的Listname進行搜尋的,這個條件可以根據政策來更改;
我們通過搜尋将user1、user11添加到郵件組,同時手動将user21、user31添加到該郵件組,(user21、user31Domino不在Domino目錄清單中)
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083445XXx4.jpg" target="_blank"></a>
同理user2、user12添加到Test2郵件組内,同時手動添加user41、user51(user41、user51Domino不在Domino目錄清單中)
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_13660834451PoV.jpg" target="_blank"></a>
同理user3、user13添加到Test3郵件組内,同時手動添加user61、user71(user61、user71Domino不在Domino目錄清單中)
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_136608344624rf.jpg" target="_blank"></a>
下面我們就是開始建立代理
我們都知道Domino是可以開發的,是通過通過Lotus designer元件
我們打開Lotus Designer
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083446MSQM.jpg" target="_blank"></a>
我們可以打開先用的應用程式,具體不細說了,
因為要建立一個代理,我們也可以在Names,nsf資料庫上建立代理,但是為了保險起見,我們建立一個空白的資料庫,然後再上面建立代理。
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083446hDK5.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083447oktd.jpg" target="_blank"></a>
确認後自動打開該資料庫的,
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083447gIbr.jpg" target="_blank"></a>
我們需要建立一個表單
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083447NJta.jpg" target="_blank"></a>
名稱任意寫,
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_13660834473UW5.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083448UTZX.jpg" target="_blank"></a>
<a href="http://s3.51cto.com/wyfs02/M01/12/67/wKioL1MF0Sryr9_gAAL5fP2nsmU792.jpg" target="_blank"></a>
然後建立一個代理
代理名稱最好跟本地的檔案名稱同名ag_get_person,當然也可以任意
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083448WYir.png" target="_blank"></a>
我們打開代碼
Sub Initialize
On Error Goto errhandle
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Dim db As NotesDatabase
Set db = session.CurrentDatabase
'打開人員資料庫
Dim namedb As NotesDatabase
Set namedb = session.GetDatabase(db.Server,"names.nsf")
If Not namedb.IsOpen Then
Msgbox "找不到人員資料庫"
Exit Sub
End If
'打開所有人員視圖
Dim nameview As NotesView
Set nameview = namedb.GetView("_People")
If nameview Is Nothing Then
Msgbox "找不到所有人員搜尋視圖,請與管理者聯系!"
'打開郵件使用者群組視圖
Dim emailview As NotesView
Set emailview= namedb.GetView("Groups1")
If emailview Is Nothing Then
Msgbox "找不到郵件使用者群組視圖,請與管理者聯系!"
'得到郵件視圖中所有群組條目
Dim vc As NotesViewEntryCollection
Set vc = emailview.AllEntries
Msgbox "郵件群組個數是:" & vc.count
If vc.count>0 Then
Dim i As Long
'循環所有試圖條目
For i = 1 To vc.Count
'擷取第i條視圖的條目
Dim entry As NotesViewEntry
Set entry = vc.GetNthEntry(i)
'擷取此條目的文檔
Dim tempdoc As NotesDocument
Set tempdoc = entry.Document
Dim key As String
'Msgbox tempdoc.ListName(0)
Dim item As NotesItem
Dim l As Integer
Dim j As Integer
l=0
Set item = tempdoc.getfirstitem("Members")
If item.text<>"" Then
j = Ubound(item.Values)
For l = 0 To j-1
key=item.Values(l)
Dim key1 As Variant
key1=Split(key,"/")
Dim key2 As Variant
key2=Split(key1(0),"=")
'Msgbox key2(1)
Dim namedoc As NotesDocument
Set namedoc = nameview.GetDocumentByKey(key2(1),True)
If namedoc Is Nothing Then
Msgbox tempdoc.ListName(0) &"組下的"& key2(1) &"不在domino清單裡!"
Next
errhandle:
Msgbox Erl & Error
End Sub
我們建立代理
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083448v3dp.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083448ExFW.jpg" target="_blank"></a>
然後單擊儲存即可;我們現在開始測試代理:
<a href="http://s3.51cto.com/wyfs02/M02/12/67/wKioL1MF0Wigg90FAAG_g7Zszqw727.jpg" target="_blank"></a>
我們打開表單:兩種方法,第一,通過預覽用戶端,第二通過web打開
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083449fiq4.jpg" target="_blank"></a>
我們首先是通過client打開;
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083449h2dw.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083449paHv.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083450Y8IW.jpg" target="_blank"></a>
這樣需要我們每次的确認來檢視有問題的使用者,非常的麻煩,我們通過第二種方法來操作
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083450UWZR.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083450pEy5.jpg" target="_blank"></a>
使用者我們需要單獨授權,在伺服器文檔可以單獨授權
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083450VPBs.jpg" target="_blank"></a>
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083451Wb8W.jpg" target="_blank"></a>
登陸進去我們發現什麼也沒有看見,如果單擊測試我們就能通過Lotus console能看見狀态,我們在單擊前,先看看Lotus console狀态
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_1366083451WHiC.jpg" target="_blank"></a>
我們接下來單擊測試
<a href="http://gaowenlong.blog.51cto.com/attachment/201304/16/451336_13660834518PE6.jpg" target="_blank"></a>
本文轉自 高文龍 51CTO部落格,原文連結:http://blog.51cto.com/gaowenlong/1179050,如需轉載請自行聯系原作者