2012-03-18 68 views
0

我想在使用java程序的lotus notes中添加新用戶,但我不知道多米諾骨牌。我試圖在我的本地做到這一點,所以我需要下載和如何做到這一點我已經在我的系統上有eclipse和蓮花筆記客戶端請幫我解決這個問題或任何示例代碼。使用java程序在lotus notes中添加新用戶

+0

並不知悉任何個人代碼,但是管理客戶端不會允許添加海量用戶。從編碼的角度來看,添加用戶的過程並非微不足道。 – 2012-03-18 08:43:46

+0

你的意思是我們不能從java程序做到。如果不是,我們如何才能做到這一點... – ran 2012-03-18 08:51:40

+0

您可以從管理員客戶端內做到這一點。點擊人員標籤,在右側是添加用戶的選項。此時的用戶界面將顯示所有設置。 – 2012-03-18 08:55:09

回答

5

查看Registration類上的「RegisterNewUser」方法。

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_REGISTERNEWUSER_METHOD_JAVA.html

應該是你在找什麼。

+1

非常感謝您的回覆,但我不知道如何開始。我的意思是如何將lotus notes與我們的eclipse項目連接起來。你能否給我簡要介紹一下。謝謝。 – ran 2012-03-18 09:02:03

+1

註釋Java API是DLL調用的包裝器。所以如果你打算在安裝了Notes客戶端的情況下使用它,那麼你需要使用Notes.JAR。如果你打算只使用連接到多米諾服務器(沒有安裝Notes),那麼使用NCSO.JAR。檢查以下http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_9_CODING_GUIDELINES_JAVA.html – 2012-03-18 09:12:23

5

所以基本上,你有兩個問題。

1)如何在不使用Domino Designer的情況下爲Eclipse中的Notes/Domino編寫Java代理?

IBM爲如何設置Eclipse以創建和調試Domino Java代理提供了一個很好的指導:「Using Lotus Notes with Eclipse to manage and run your Java programs」。 通過谷歌,我還發現了一個很好的教程Michel Van der MeirenRishi

2)如何在Java代理內創建新的Domino用戶?

正如Simon已經提到的,在Registration類中有「RegisterNewUser」方法。由於您需要驗證者文件,建議Domino管理員首先創建一個「Domino server-based certification authority」。使用它,您不需要訪問Java應用程序中的驗證者文件來創建新用戶。

0

此代理註冊一個示例用戶。

如需進一步信息:(example link

import lotus.domino.*; 
import java.util.Vector; 
public class JavaAgent extends AgentBase { 
    public void NotesMain() { 
    try { 
     Session session = getSession(); 
     AgentContext agentContext = session.getAgentContext(); 
     // (Your code goes here) 
     Registration reg = session.createRegistration(); 
     reg.setRegistrationServer("localhost"); //provide here your server name 
     reg.setCreateMailDb(true); 
     reg.setCertifierIDFile("c:\\NotesAdministrator\\cert.id"); 
     DateTime dt = session.createDateTime("Today"); 
     dt.setNow(); 
     dt.adjustYear(1); 
     reg.setExpiration(dt); 
     reg.setIDType(Registration.ID_HIERARCHICAL); 
     reg.setNorthAmerican(false); 
     reg.setMinPasswordLength(5); // password strength 
     Vector orgs = new Vector(); 
     orgs.addElement("Japanese OU"); 
     orgs.addElement("PRC OU"); 
     orgs.addElement("Korean OU"); 
     reg.setAltOrgUnit(orgs); 
     Vector langs = new Vector(); 
     langs.addElement("ja"); 
     langs.addElement("zh-CN"); 
     langs.addElement("ko"); 
     reg.setAltOrgUnitLang(langs); 
     reg.setUpdateAddressBook(true); 
     reg.setStoreIDInAddressBook(true); 
     if (reg.registerNewUser("Taylor", // last name 
     "c:\\NotesAdministrator\\mtaylor.id", // file to be created 
     "CN=AceOne/O=AceHardware", // mail server 
     "Mike", // first name 
     "", // middle initial 
     "AceHardware", // certifier password 
     "", // location field 
     "", // comment field 
     "mail\\mtaylor.nsf", // mail file 
     "", // forwarding domain 
     "AceHardware", //user password 
     "Japanese name for Mike", //alternate name 
     "ja")) // alternate language 
     { 
     System.out.println("Registration succeeded"); 
     } 
     else { 
     System.out.println("Registration failed"); 
     } 

    } catch(NotesException e) { 
     System.out.println(e.id + " " + e.text); 
     e.printStackTrace(); 
    } 
    } 
} 
相關問題